Skip to content
Aggre Docs

Loading…

Console

API reference

Accounts API reference

Login, sessions, accounts, organizations, invitations and API-key management routes.

Every route of the accounts service at https://accounts.aggre.org that a signed-in person's browser uses. Read the accounts API overview first: these routes take a session cookie (not an API key), an allowed Origin and, for anything but GET, the header X-Aggre-CSRF: 1. The OpenAPI file is /openapi/accounts.yaml (also JSON).

The platform-staff routes under /v1/admin/* are not part of this reference.

GroupRouteSummary
ConfigurationGET /v1/configPublic console configuration (login buttons, limits, defaults)
Login and sessionsGET /login/{provider}Start a login (full-page navigation, answers 302 to the provider)
Login and sessionsGET /login/callback/{provider}OAuth redirect URI. Sets the session cookie and answers 302 to return_to or {origin}/login?error=<code>
Login and sessionsPOST /v1/auth/logoutRevoke the current session and clear its cookie
Login and sessionsPOST /v1/auth/logout-allRevoke every session of the user (both audiences)
The signed-in userGET /v1/meThe signed-in user, identities, memberships and session
The signed-in userDELETE /v1/meDelete the personal account (keys revoked, identities and sessions removed, handle stays reserved)
The signed-in userDELETE /v1/me/identities/{identity_id}Unlink a login method (409 if it is the last one)
Accounts and usageGET /v1/handles/{handle}Is this handle usable? (signed-in users only)
Accounts and usageGET /v1/accounts/{handle}One account you can see (self, member, or staff)
Accounts and usagePATCH /v1/accounts/{handle}Change display_name and/or handle (user: self; org: owner). First rename free, then once per 30 days.
Accounts and usageGET /v1/accounts/{handle}/usageRequest counts per UTC day and per key over the last N days
Accounts and usageGET /v1/accounts/{handle}/auditAudit log of the account (owner/admin/staff), newest first
API keysGET /v1/accounts/{handle}/api-keysKeys of the account, newest first, revoked ones included (max 200). Never contains secrets.
API keysPOST /v1/accounts/{handle}/api-keysCreate a key. The secret is in the response once and never again.
API keysPATCH /v1/accounts/{handle}/api-keys/{key_id}Rename a key or replace its ip_allowlist
API keysDELETE /v1/accounts/{handle}/api-keys/{key_id}Revoke a key (takes effect on the gateway within ~30 s)
Organizations and membersPOST /v1/orgsCreate an org; the caller becomes its owner
Organizations and membersDELETE /v1/orgs/{handle}Delete an org (owner). Keys are revoked, memberships removed, the handle stays reserved.
Organizations and membersGET /v1/orgs/{handle}/membersMembers of the org (any member, or staff)
Organizations and membersPATCH /v1/orgs/{handle}/members/{user_handle}Change a member's role (owner). 409 if it would leave no owner.
Organizations and membersDELETE /v1/orgs/{handle}/members/{user_handle}Remove a member, or leave (user_handle = yourself). 409 for the last owner.
InvitationsGET /v1/orgs/{handle}/invitationsPending invitations (owner/admin)
InvitationsPOST /v1/orgs/{handle}/invitationsInvite an e-mail address. Re-inviting the same address replaces the pending invitation. No e-mail is sent; share the link.
InvitationsDELETE /v1/orgs/{handle}/invitations/{invitation_id}Revoke a pending invitation
InvitationsGET /v1/invitations/{token}What an invitation link is for (no session needed, so the page can ask the visitor to sign in first)
InvitationsPOST /v1/invitations/{token}/acceptJoin the org. The caller's verified primary e-mail must equal the invited address (403 email_mismatch).

Public console configuration (login buttons, limits, defaults)#

GET /v1/config

Response 200

FieldTypeRequiredDescription
dataConfigyes

Start a login (full-page navigation, answers 302 to the provider)#

GET /login/{provider}

Parameters

NameInRequiredTypeDescription
providerpathyesstring
audiencequerynoapp | admin (default app)
return_toquerynostring, uriAbsolute URL on the audience origin; otherwise ignored.
linkqueryno1Attach this provider to the signed-in user.

Errors: 302, 400, in the shared envelope (Errors).

OAuth redirect URI. Sets the session cookie and answers 302 to return_to or {origin}/login?error=<code>#

GET /login/callback/{provider}

Parameters

NameInRequiredTypeDescription
providerpathyesstring
codequerynostring
statequerynostring
errorquerynostring

Errors: 302, 400, in the shared envelope (Errors).

Revoke the current session and clear its cookie#

POST /v1/auth/logout

Response 204.

Revoke every session of the user (both audiences)#

POST /v1/auth/logout-all

Response 204.

The signed-in user, identities, memberships and session#

GET /v1/me

Response 200

FieldTypeRequiredDescription
dataMeyes

Errors: 401, in the shared envelope (Errors).

Delete the personal account (keys revoked, identities and sessions removed, handle stays reserved)#

DELETE /v1/me

Parameters

NameInRequiredTypeDescription
confirmqueryyesstringMust equal the user's handle.

Response 204.

Errors: 401, 409, in the shared envelope (Errors).

Unlink a login method (409 if it is the last one)#

DELETE /v1/me/identities/{identity_id}

Parameters

NameInRequiredTypeDescription
identity_idpathyesstring, uuid

Response 204.

Errors: 404, 409, in the shared envelope (Errors).

Is this handle usable? (signed-in users only)#

GET /v1/handles/{handle}

Parameters

NameInRequiredTypeDescription
handlepathyesstring

Response 200

FieldTypeRequiredDescription
dataobjectyes
data.handlestringyes
data.availablebooleanyes
data.reasoninvalid | reserved | taken | nullno

One account you can see (self, member, or staff)#

GET /v1/accounts/{handle}

Parameters

NameInRequiredTypeDescription
handlepathyesstring

Response 200

FieldTypeRequiredDescription
dataAccountyes

Errors: 404, in the shared envelope (Errors).

Change display_name and/or handle (user: self; org: owner). First rename free, then once per 30 days.#

PATCH /v1/accounts/{handle}

Parameters

NameInRequiredTypeDescription
handlepathyesstring

Request body (JSON)

FieldTypeRequiredDescription
display_namenullable, stringno
handlestringno

Response 200

FieldTypeRequiredDescription
dataAccountyes

Errors: 403, 404, 409, in the shared envelope (Errors).

Request counts per UTC day and per key over the last N days#

GET /v1/accounts/{handle}/usage

Parameters

NameInRequiredTypeDescription
handlepathyesstring
daysquerynointeger, 1–90, default 30

Response 200

FieldTypeRequiredDescription
dataUsageyes

Errors: 404, in the shared envelope (Errors).

Audit log of the account (owner/admin/staff), newest first#

GET /v1/accounts/{handle}/audit

Parameters

NameInRequiredTypeDescription
handlepathyesstring
limitquerynointeger, 1–100, default 50
beforequerynointeger, int64Return entries with id < before.

Response 200

FieldTypeRequiredDescription
dataarray of AuditEntryyes
next_beforenullable, integer, int64yes

Errors: 403, 404, in the shared envelope (Errors).

Keys of the account, newest first, revoked ones included (max 200). Never contains secrets.#

GET /v1/accounts/{handle}/api-keys

Parameters

NameInRequiredTypeDescription
handlepathyesstring

Response 200

FieldTypeRequiredDescription
dataarray of ApiKeyyes

Errors: 404, in the shared envelope (Errors).

Create a key. The secret is in the response once and never again.#

POST /v1/accounts/{handle}/api-keys

Parameters

NameInRequiredTypeDescription
handlepathyesstring

Request body (JSON)

FieldTypeRequiredDescription
namestringyes
usage_limitnullable, integer, int64noOmit = server default. null (Unlimited) and values above the default: staff only.
usage_periodday | month | totalno
rate_policydefault | exemptnoexempt: staff only.
internalboolean, default falsenotrue gives the key the internal scope (the data API's /v1/internal/* per-row routes). Platform staff on an admin session, freshly signed in; anyone else gets 403.
ip_allowlistarray of stringno
expires_atnullable, string, date-timeno

Response 201

FieldTypeRequiredDescription
dataApiKeyyes
secretstringyes

Errors: 400, 403, 404, 409, in the shared envelope (Errors).

Rename a key or replace its ip_allowlist#

PATCH /v1/accounts/{handle}/api-keys/{key_id}

Parameters

NameInRequiredTypeDescription
handlepathyesstring
key_idpathyesstring, uuid

Request body (JSON)

FieldTypeRequiredDescription
namestringno
ip_allowlistarray of stringnoCIDRs or bare addresses; [] = open.

Response 200

FieldTypeRequiredDescription
dataApiKeyyes

Errors: 400, 403, 404, in the shared envelope (Errors).

Revoke a key (takes effect on the gateway within ~30 s)#

DELETE /v1/accounts/{handle}/api-keys/{key_id}

Parameters

NameInRequiredTypeDescription
handlepathyesstring
key_idpathyesstring, uuid

Response 204.

Errors: 403, 404, in the shared envelope (Errors).

Create an org; the caller becomes its owner#

POST /v1/orgs

Request body (JSON)

FieldTypeRequiredDescription
handlestringyes
display_namestringno

Response 201

FieldTypeRequiredDescription
dataAccountyes

Errors: 400, 409, in the shared envelope (Errors).

Delete an org (owner). Keys are revoked, memberships removed, the handle stays reserved.#

DELETE /v1/orgs/{handle}

Parameters

NameInRequiredTypeDescription
handlepathyesstring
confirmqueryyesstringMust equal the org handle.

Response 204.

Errors: 403, 404, in the shared envelope (Errors).

Members of the org (any member, or staff)#

GET /v1/orgs/{handle}/members

Parameters

NameInRequiredTypeDescription
handlepathyesstring

Response 200

FieldTypeRequiredDescription
dataarray of Memberyes

Errors: 404, in the shared envelope (Errors).

Change a member's role (owner). 409 if it would leave no owner.#

PATCH /v1/orgs/{handle}/members/{user_handle}

Parameters

NameInRequiredTypeDescription
handlepathyesstring
user_handlepathyesstring

Request body (JSON)

FieldTypeRequiredDescription
roleRoleyes

Response 200

FieldTypeRequiredDescription
dataMemberyes

Errors: 403, 404, 409, in the shared envelope (Errors).

Remove a member, or leave (user_handle = yourself). 409 for the last owner.#

DELETE /v1/orgs/{handle}/members/{user_handle}

Parameters

NameInRequiredTypeDescription
handlepathyesstring
user_handlepathyesstring

Response 204.

Errors: 403, 404, 409, in the shared envelope (Errors).

Pending invitations (owner/admin)#

GET /v1/orgs/{handle}/invitations

Parameters

NameInRequiredTypeDescription
handlepathyesstring

Response 200

FieldTypeRequiredDescription
dataarray of Invitationyes

Errors: 403, 404, in the shared envelope (Errors).

Invite an e-mail address. Re-inviting the same address replaces the pending invitation. No e-mail is sent; share the link.#

POST /v1/orgs/{handle}/invitations

Parameters

NameInRequiredTypeDescription
handlepathyesstring

Request body (JSON)

FieldTypeRequiredDescription
emailstring, emailyes
roleRoleno

Response 201

FieldTypeRequiredDescription
dataInvitationyes
tokenstringyesOne-time secret; the console links to {app}/invitations/{token}.

Errors: 400, 403, 404, 409, in the shared envelope (Errors).

Revoke a pending invitation#

DELETE /v1/orgs/{handle}/invitations/{invitation_id}

Parameters

NameInRequiredTypeDescription
handlepathyesstring
invitation_idpathyesstring, uuid

Response 204.

Errors: 403, 404, in the shared envelope (Errors).

What an invitation link is for (no session needed, so the page can ask the visitor to sign in first)#

GET /v1/invitations/{token}

Parameters

NameInRequiredTypeDescription
tokenpathyesstring

Response 200

FieldTypeRequiredDescription
dataobjectyes
data.orgobjectyes
data.roleRoleyes
data.email_hintstringyes
data.expires_atstring, date-timeyes

Errors: 404, in the shared envelope (Errors).

Join the org. The caller's verified primary e-mail must equal the invited address (403 email_mismatch).#

POST /v1/invitations/{token}/accept

Parameters

NameInRequiredTypeDescription
tokenpathyesstring

Response 200

FieldTypeRequiredDescription
dataobjectyes
data.orgAccountyes
data.roleRoleyes

Errors: 401, 403, 404, 409, in the shared envelope (Errors).

Generated from contracts/accounts.openapi.yaml when the site is built, so it matches the API contract.