Account and Personal keys
Your profile, two-factor sign-in, sessions, Personal keys, the CLI device login and the sign-up checks.
These routes act on you, the person the key belongs to, not on an Organization. Making, listing and revoking Personal keys, two-factor changes, revoking a session and changing your sign-in email need a signed-in console session: a Personal key is refused there with 403, except that a key may delete itself (what cloudgate logout does).
Every request goes to https://cloudgate.octabyte.app/backend on the Hosted instance, or to your console address followed by /backend when you self-host. Send a Personal key in x-api-key and the Organization in x-organization-id; Authentication shows how to make the key, and Errors explains every refusal. The examples setCLOUDGATE_KEY and CLOUDGATE_ORG_ID in the shell first. To do the same in the console, read Personal keys in the user guide.
You and your keys
Get your profile
GET/users/me
Who can call it: You: any signed-in person, with a Personal key or a console session.
Responses
200OK- The result, as JSON.
- Refusals
401No key, or the key is not valid. The error body.
curl https://cloudgate.octabyte.app/backend/users/me \
-H "x-api-key: $CLOUDGATE_KEY" \
-H "x-organization-id: $CLOUDGATE_ORG_ID"Update your profile
PATCH/users/me
Who can call it: You. Changing the sign-in email needs a signed-in console session; a Personal key is refused with 403.
Request body
| Field | Type | Notes |
|---|---|---|
firstName | string | 1 to 255 characters. |
lastName | string | Up to 255 characters. |
email | string (email) | Up to 255 characters. Matches ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$. |
currentPassword | string | Not empty. |
image | string (uri) or null |
Responses
200OK- The result, as JSON.
- Refusals
400Validation failed;detailsnames each field;401No key, or the key is not valid;403Sent with a Personal key where a console session is needed. The error body.
curl -X PATCH https://cloudgate.octabyte.app/backend/users/me \
-H "x-api-key: $CLOUDGATE_KEY" \
-H "x-organization-id: $CLOUDGATE_ORG_ID" \
-H "content-type: application/json" \
-d '{
"firstName": "example",
"lastName": "example",
"email": "ada@northwind.dev"
}'Show who a key belongs to
GET/users/me/whoami
Who can call it: You: any signed-in person, with a Personal key or a console session.
Responses
200OK- Who this request is made as: the email, the Organization it acts in, and the Personal key it carries (null for a console session). Answers only about the key the request was made with, never another.
- Refusals
401No key, or the key is not valid. The error body.
| Field | Type | Notes |
|---|---|---|
emailalways | string | |
organizationalways | object or null | |
organization.idalways | string | |
organization.namealways | string | |
keyalways | object or null | |
key.idalways | string | |
key.namealways | string or null | |
key.startalways | string or null | |
key.expiresAtalways | string or null |
curl https://cloudgate.octabyte.app/backend/users/me/whoami \
-H "x-api-key: $CLOUDGATE_KEY" \
-H "x-organization-id: $CLOUDGATE_ORG_ID"Turn on two-factor sign-in
POST/users/me/2fa/enable
Who can call it: You, from a signed-in console session only: a Personal key is refused with 403.
Request body
| Field | Type | Notes |
|---|---|---|
passwordrequired | string | Not empty. |
Responses
200OK- The result, as JSON.
- Refusals
400Validation failed;detailsnames each field;401No key, or the key is not valid;403Sent with a Personal key where a console session is needed. The error body.
curl -X POST https://cloudgate.octabyte.app/backend/users/me/2fa/enable \
-H "x-api-key: $CLOUDGATE_KEY" \
-H "x-organization-id: $CLOUDGATE_ORG_ID" \
-H "content-type: application/json" \
-d '{
"password": "<secret>"
}'Verify a two-factor code
POST/users/me/2fa/verify
Who can call it: You, from a signed-in console session only: a Personal key is refused with 403.
Request body
| Field | Type | Notes |
|---|---|---|
coderequired | string | Not empty. |
Responses
200OK- The result, as JSON.
- Refusals
400Validation failed;detailsnames each field;401No key, or the key is not valid;403Sent with a Personal key where a console session is needed. The error body.
curl -X POST https://cloudgate.octabyte.app/backend/users/me/2fa/verify \
-H "x-api-key: $CLOUDGATE_KEY" \
-H "x-organization-id: $CLOUDGATE_ORG_ID" \
-H "content-type: application/json" \
-d '{
"code": "example"
}'Turn off two-factor sign-in
POST/users/me/2fa/disable
Who can call it: You, from a signed-in console session only: a Personal key is refused with 403.
Request body
| Field | Type | Notes |
|---|---|---|
passwordrequired | string | Not empty. |
Responses
200OK- The result, as JSON.
- Refusals
400Validation failed;detailsnames each field;401No key, or the key is not valid;403Sent with a Personal key where a console session is needed. The error body.
curl -X POST https://cloudgate.octabyte.app/backend/users/me/2fa/disable \
-H "x-api-key: $CLOUDGATE_KEY" \
-H "x-organization-id: $CLOUDGATE_ORG_ID" \
-H "content-type: application/json" \
-d '{
"password": "<secret>"
}'List your sessions
GET/users/me/sessions
Who can call it: You: any signed-in person, with a Personal key or a console session.
Responses
200OK- The caller's own sessions. Deliberately carries no session token — the token is the credential, and revocation is by
id. - Refusals
401No key, or the key is not valid. The error body.
| Field | Type | Notes |
|---|---|---|
[].idalways | string | |
[].userIdalways | string | |
[].userAgent | string or null | |
[].ipAddress | string or null | |
[].createdAtalways | string (date-time) | |
[].expiresAtalways | string (date-time) |
curl https://cloudgate.octabyte.app/backend/users/me/sessions \
-H "x-api-key: $CLOUDGATE_KEY" \
-H "x-organization-id: $CLOUDGATE_ORG_ID"List your Personal keys
GET/users/me/api-keys
Who can call it: You, from a signed-in console session only: a Personal key is refused with 403.
Responses
200OK- The result, as JSON.
- Refusals
401No key, or the key is not valid;403Sent with a Personal key where a console session is needed. The error body.
curl https://cloudgate.octabyte.app/backend/users/me/api-keys \
-H "x-api-key: $CLOUDGATE_KEY" \
-H "x-organization-id: $CLOUDGATE_ORG_ID"Create a Personal key
POST/users/me/api-keys
Who can call it: You, from a signed-in console session only: a Personal key is refused with 403.
Request body
| Field | Type | Notes |
|---|---|---|
namerequired | string | 1 to 255 characters. |
prefix | string | Up to 64 characters. |
expiresIn | integer | At least 0. More than true. |
Responses
201Created- The result, as JSON.
- Refusals
400Validation failed;detailsnames each field;401No key, or the key is not valid;403Sent with a Personal key where a console session is needed. The error body.
curl -X POST https://cloudgate.octabyte.app/backend/users/me/api-keys \
-H "x-api-key: $CLOUDGATE_KEY" \
-H "x-organization-id: $CLOUDGATE_ORG_ID" \
-H "content-type: application/json" \
-d '{
"name": "Ada Lovelace"
}'Delete a Personal key
DELETE/users/me/api-keys/{id}
Who can call it: You, from a signed-in console session; a Personal key may delete only itself.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
idrequired | path | string | The user's id. |
Responses
200OK- The result, as JSON.
- Refusals
401No key, or the key is not valid;403Sent with a Personal key where a console session is needed;404Nothing with that id in this Organization. The error body.
curl -X DELETE https://cloudgate.octabyte.app/backend/users/me/api-keys/RAU6yAYUXFRdXdPLyLoPC \
-H "x-api-key: $CLOUDGATE_KEY" \
-H "x-organization-id: $CLOUDGATE_ORG_ID"Revoke a session
POST/users/me/sessions/revoke
Who can call it: You, from a signed-in console session only: a Personal key is refused with 403.
Request body
| Field | Type | Notes |
|---|---|---|
sessionIdrequired | string | Not empty. |
Responses
200OK- The result, as JSON.
- Refusals
400Validation failed;detailsnames each field;401No key, or the key is not valid;403Sent with a Personal key where a console session is needed. The error body.
curl -X POST https://cloudgate.octabyte.app/backend/users/me/sessions/revoke \
-H "x-api-key: $CLOUDGATE_KEY" \
-H "x-organization-id: $CLOUDGATE_ORG_ID" \
-H "content-type: application/json" \
-d '{
"sessionId": "jouKjCrujNdcqEeKJNcoP"
}'Device login
Start a device login
POST/auth/device/code
Who can call it: Public: no key needed.
Request body
A object.
Responses
200OK- Starts a CLI login: a code for the person to approve at /device, and the device code the CLI polls with. Takes no fields; in particular no user, so a code is bound only to whoever approves it.
- Refusals
400Validation failed;detailsnames each field. The error body.
| Field | Type | Notes |
|---|---|---|
deviceCodealways | string | |
userCodealways | string | |
intervalalways | number | |
expiresInalways | number |
curl -X POST https://cloudgate.octabyte.app/backend/auth/device/code \
-H "content-type: application/json" \
-d '{}'Poll a device login for its key
POST/auth/device/token
Who can call it: Public: no key needed.
Request body
| Field | Type | Notes |
|---|---|---|
deviceCoderequired | string | Not empty. |
name | string | 1 to 100 characters. |
replaces | string | 1 to 200 characters. |
Responses
200OK- The CLI's poll. Once the code is approved, a Personal key ending 90 days after login, answered once; until then a 400 whose code is AUTHORIZATION_PENDING, SLOW_DOWN, EXPIRED_TOKEN, ACCESS_DENIED or INVALID_GRANT.
- Refusals
400Validation failed;detailsnames each field. The error body.
| Field | Type | Notes |
|---|---|---|
keyalways | string | |
keyIdalways | string | |
expiresAtalways | string |
curl -X POST https://cloudgate.octabyte.app/backend/auth/device/token \
-H "content-type: application/json" \
-d '{
"deviceCode": "example"
}'Sign-up checks
Check whether sign-up is open
GET/auth/sign-up-open
open is whether an uninvited sign-up is accepted now; state says which of the four SignUpStates that is, because the screen says different things for each: "Set up this instance" and "Already set up" when Self-hosted, "Not open yet" and the public form when Hosted.
Who can call it: Public: no key needed.
Responses
200OK- The result, as JSON.
curl https://cloudgate.octabyte.app/backend/auth/sign-up-openCheck whether password reset works
GET/auth/password-reset-open
Who can call it: Public: no key needed.
Responses
200OK- The result, as JSON.
curl https://cloudgate.octabyte.app/backend/auth/password-reset-openPreview an invitation
GET/auth/invitations/{id}
Who can call it: Public: no key needed.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
idrequired | path | string | The id. |
Responses
200OK- The result, as JSON.
- Refusals
404Nothing with that id in this Organization. The error body.
curl https://cloudgate.octabyte.app/backend/auth/invitations/RAU6yAYUXFRdXdPLyLoPCSomething missing or wrong on this page? Email support@octabyte.io, or start a free trial and try it in the console.