POST
/
users
/
{userId}
/
apikeys
curl --request POST \
  --url https://api.sulu.sh/v0/users/{userId}/apikeys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "expiresAt": "2023-11-07T05:31:56Z",
  "mode": "live",
  "organizationIds": [
    "<string>"
  ]
}'
{
  "key": "<string>",
  "principals": [
    {
      "id": "<string>",
      "organizationId": "<string>"
    }
  ],
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "expiresAt": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

userId
string
required

Unique identifier for a user

Body

application/json
expiresAt
string

The date and time when the API key will expire. If not provided, the API key will never expire.

mode
enum<string>
default:live

The mode of the API key. Determines the key prefix (sk_test_ or sk_live_). At the moment only live keys are supported.

Available options:
test,
live
organizationIds
string[]

Optional list of organization IDs to filter principals. If not provided, all user's principals will be included.

Unique identifier for an organization

Response

201
application/json
API key created successfully
key
string

The API key

principals
object[]
createdAt
string
updatedAt
string
expiresAt
string