Skip to main content

Authentication & Tokens

Obtain and manage API access tokens. Authenticate every request with Authorization: Bearer <token>. Create a personal token via POST /api/me/api-tokens or an org-scoped token via POST /api/orgs/{org_id}/api-tokens.

Endpoints

MethodPathDescription
GET/api/meGet the current user
GET/api/me/api-tokensList personal access tokens
POST/api/me/api-tokensCreate a personal access token
DELETE/api/me/api-tokens/{id}Revoke a personal access token
GET/api/orgs/{org_id}/api-tokensList org API tokens
POST/api/orgs/{org_id}/api-tokensCreate an org API token
DELETE/api/orgs/{org_id}/api-tokens/{id}Revoke an org API token

Get the current user

GET /api/me

Returns the authenticated user, the token in use (for Bearer auth), post-signup intake state, and all organizations the user belongs to with their role and tier limits.

Responses:

StatusBodyDescription
200data: objectCurrent user and organizations.
401ErrorAuthentication is missing, invalid, or expired.

Example request:

curl "https://connect.peridio.com/api/me" \
-H "Authorization: Bearer $AVOCADO_TOKEN"

Example response (200):

{
"data": {
"token": {
"name": "string",
"organization_id": "0198a2e6-6f24-7cc3-b456-663cd21c4b12"
},
"user": {
"id": "0198a2e6-6f24-7cc3-b456-663cd21c4b12",
"email": "string",
"name": "string",
"username": "string",
"avatar_url": "string",
"is_super_user": true,
"has_logged_in": true,
"auth_provider": "string"
},
"intake": {
"status": "dismissed",
"submitted_at": "2026-08-14T12:00:00Z"
},
"organizations": [
{
"id": "0198a2e6-6f24-7cc3-b456-663cd21c4b12",
"name": "string",
"slug": "string",
"tier": "development",
"role": "owner",
"max_users": 0,
"max_devices": 0,
"max_tunnels": 0,
"max_claim_tokens": 0,
"subscription_status": "string",
"stripe_enabled": true
}
]
}
}

List personal access tokens

GET /api/me/api-tokens

Lists the current user's personal access tokens (raw token values are never returned).

Responses:

StatusBodyDescription
200data: array of PersonalAccessTokenTokens.
401ErrorAuthentication is missing, invalid, or expired.

Example request:

curl "https://connect.peridio.com/api/me/api-tokens" \
-H "Authorization: Bearer $AVOCADO_TOKEN"

Example response (200):

{
"data": [
{
"id": "0198a2e6-6f24-7cc3-b456-663cd21c4b12",
"name": "string",
"last_used_at": "2026-08-14T12:00:00Z",
"expires_at": "2026-08-14T12:00:00Z",
"inserted_at": "2026-08-14T12:00:00Z"
}
]
}

Create a personal access token

POST /api/me/api-tokens

Creates a personal access token. The raw token is returned once in data.raw_token and never again — store it securely. Use it as a Bearer token.

Request body:

FieldTypeRequiredDescription
namestringYes

Responses:

StatusBodyDescription
201data: objectToken created.
422ValidationErrorRequest body failed validation.

Example request:

curl -X POST "https://connect.peridio.com/api/me/api-tokens" \
-H "Authorization: Bearer $AVOCADO_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "string"
}'

Example response (201):

{
"data": {
"token": {
"id": "0198a2e6-6f24-7cc3-b456-663cd21c4b12",
"name": "string",
"last_used_at": "2026-08-14T12:00:00Z",
"expires_at": "2026-08-14T12:00:00Z",
"inserted_at": "2026-08-14T12:00:00Z"
},
"raw_token": "string"
}
}

Revoke a personal access token

DELETE /api/me/api-tokens/{id}

Path parameters:

NameTypeDescription
idstringToken ID.

Responses:

StatusBodyDescription
200OkRevoked.
404ErrorResource not found.

Example request:

curl -X DELETE "https://connect.peridio.com/api/me/api-tokens/{id}" \
-H "Authorization: Bearer $AVOCADO_TOKEN"

Example response (200):

{
"ok": true
}

List org API tokens

GET /api/orgs/{org_id}/api-tokens

Lists the organization's API tokens (raw values omitted).

Path parameters:

NameTypeDescription
org_idstring (uuid)Organization UUID.

Query parameters:

NameTypeRequiredDescription
cursorstringNoOpaque pagination cursor from a prior response's meta.after/meta.before.
limitintegerNoMax items per page (clamped 1–100). Defaults to 20. Range 1–100.
directionstringNoPage direction relative to the cursor. One of: after, before. Defaults to "after".

Responses:

StatusBodyDescription
200data: object, meta: PaginationMetaTokens.

Example request:

curl "https://connect.peridio.com/api/orgs/{org_id}/api-tokens" \
-H "Authorization: Bearer $AVOCADO_TOKEN"

Example response (200):

{
"data": {
"tokens": [
{
"id": "0198a2e6-6f24-7cc3-b456-663cd21c4b12",
"name": "string",
"organization_id": "0198a2e6-6f24-7cc3-b456-663cd21c4b12",
"owner": {
"id": "0198a2e6-6f24-7cc3-b456-663cd21c4b12",
"name": "string",
"email": "string"
},
"last_used_at": "2026-08-14T12:00:00Z",
"expires_at": "2026-08-14T12:00:00Z",
"created_at": "2026-08-14T12:00:00Z"
}
]
},
"meta": {
"after": "string",
"before": "string",
"has_next": true,
"has_previous": true,
"total": 0
}
}

Create an org API token

POST /api/orgs/{org_id}/api-tokens

Creates an org-scoped API token owned by the current user. The raw token is returned once in data.token.token.

Path parameters:

NameTypeDescription
org_idstring (uuid)Organization UUID.

Request body:

FieldTypeRequiredDescription
namestringYes

Responses:

StatusBodyDescription
201data: objectCreated.
422ValidationErrorRequest body failed validation.

Example request:

curl -X POST "https://connect.peridio.com/api/orgs/{org_id}/api-tokens" \
-H "Authorization: Bearer $AVOCADO_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "string"
}'

Example response (201):

{
"data": {
"token": {
"id": "0198a2e6-6f24-7cc3-b456-663cd21c4b12",
"name": "string",
"organization_id": "0198a2e6-6f24-7cc3-b456-663cd21c4b12",
"owner": {
"id": "0198a2e6-6f24-7cc3-b456-663cd21c4b12",
"name": "string",
"email": "string"
},
"last_used_at": "2026-08-14T12:00:00Z",
"expires_at": "2026-08-14T12:00:00Z",
"created_at": "2026-08-14T12:00:00Z",
"token": "string"
}
}
}

Revoke an org API token

DELETE /api/orgs/{org_id}/api-tokens/{id}

Path parameters:

NameTypeDescription
org_idstring (uuid)Organization UUID.
idstring

Responses:

StatusBodyDescription
204Revoked.
404ErrorResource not found.

Example request:

curl -X DELETE "https://connect.peridio.com/api/orgs/{org_id}/api-tokens/{id}" \
-H "Authorization: Bearer $AVOCADO_TOKEN"

Object reference

User

FieldTypeDescription
idstringUser UUID.
emailstring (email)
namestring
usernamestringNullable.
avatar_urlstringNull for email+password users. Nullable.

OrganizationMembership

An organization the current user belongs to, with their role and the org's tier limits.

FieldTypeDescription
idstring
namestring
slugstring
tierstringOne of: development, startup, teams, pro, enterprise.
rolestringOne of: owner, admin, member.
max_usersintegerNullable.
max_devicesintegerNullable.
max_tunnelsintegerNullable.
max_claim_tokensintegerNullable.
subscription_statusstringNullable.
stripe_enabledboolean

Error

Standard error envelope.

FieldTypeDescription
errorstringMachine-readable error code.
messagestringHuman-readable explanation.

PersonalAccessToken

FieldTypeDescription
idstring
namestring
last_used_atstring (date-time)Nullable.
expires_atstring (date-time)Nullable.
inserted_atstring (date-time)

ValidationError

Changeset validation error. Keys are field names; values are lists of messages.

FieldTypeDescription
errorsobject

Ok

Simple acknowledgement.

FieldTypeDescription
okboolean

OrgApiToken

FieldTypeDescription
idstring
namestring
organization_idstring
ownerUserRefNullable.
last_used_atstring (date-time)Nullable.
expires_atstring (date-time)Nullable.
created_atstring (date-time)
tokenstringRaw Bearer token — returned only on create.

UserRef

FieldTypeDescription
idstring
namestring
emailstring

PaginationMeta

Cursor pagination metadata. Present only when the request supplied a pagination param (cursor, limit, or direction); otherwise the full list is returned unpaginated with no meta.

FieldTypeDescription
afterstringOpaque cursor for the next page. Pass back as ?cursor=. Nullable.
beforestringOpaque cursor for the previous page. Nullable.
has_nextboolean
has_previousboolean
totalintegerNullable.