WorkOS PHP SDK

ApiKeys
in package

Table of Contents

Properties

$client  : HttpClient

Methods

__construct()  : mixed
createOrganizationApiKey()  : ApiKeyWithValue
Create an API key for an organization
createValidation()  : ApiKeyValidationResponse
Validate API key
deleteApiKey()  : void
Delete an API key
listOrganizationApiKeys()  : PaginatedResponse<string|int, ApiKey>
List API keys for an organization

Properties

Methods

createOrganizationApiKey()

Create an API key for an organization

public createOrganizationApiKey(string $organizationId, string $name[, array<string|int, string>|null $permissions = null ][, RequestOptions|null $options = null ]) : ApiKeyWithValue

Create a new API key for an organization.

Parameters
$organizationId : string

Unique identifier of the Organization.

$name : string

The name for the API key.

$permissions : array<string|int, string>|null = null

The permission slugs to assign to the API key.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
ApiKeyWithValue

deleteApiKey()

Delete an API key

public deleteApiKey(string $id[, RequestOptions|null $options = null ]) : void

Permanently deletes an API key. This action cannot be undone. Once deleted, any requests using this API key will fail authentication.

Parameters
$id : string

The unique ID of the API key.

$options : RequestOptions|null = null
Tags
throws
WorkOSException

listOrganizationApiKeys()

List API keys for an organization

public listOrganizationApiKeys(string $organizationId[, string|null $before = null ][, string|null $after = null ][, int|null $limit = null ][, EventsOrder $order = EventsOrder::Desc ][, RequestOptions|null $options = null ]) : PaginatedResponse<string|int, ApiKey>

Get a list of all API keys for an organization.

Parameters
$organizationId : string

Unique identifier of the Organization.

$before : string|null = null

An object ID that defines your place in the list. When the ID is not present, you are at the end of the list.

$after : string|null = null

An object ID that defines your place in the list. When the ID is not present, you are at the end of the list.

$limit : int|null = null

Upper limit on the number of objects to return, between 1 and 100. Defaults to 10.

$order : EventsOrder = EventsOrder::Desc

Order the results by the creation time. Defaults to "desc".

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
PaginatedResponse<string|int, ApiKey>

        
On this page

Search results