ampr docs

Organization

Organization details, API keys, and member management

GET /organization Get current organization details

Responses

200 Organization detail

PropertyTypeRequiredDescription
dataOrganization
PropertyTypeRequiredDescription
idstringrequired
namestringrequired
planenum
  • sandbox
  • growth
  • enterprise
required
charger_countinteger
socket_countinteger
created_atstringformat: date-timerequired

401 Missing or invalid API key application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

Request example

curl -X GET "https://api.ampr.dev/v1/organization" \
  -H "Authorization: Bearer $AMPR_API_KEY"
Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.

GET /organization/members List organization members

List members of the caller's org (viewer+).

Responses

200 Member list

PropertyTypeRequiredDescription
dataarray<OrgMember>
PropertyTypeRequiredDescription
user_idstringrequired
emailstringformat: emailrequired
namestringnullable
roleOrgRole
  • owner
  • admin
  • operator
  • viewer
requiredOrdinal organization role — `owner > admin > operator > viewer`.
created_atstringformat: date-timerequired

401 Missing or invalid API key application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

403 Authenticated but not authorized for this action (insufficient role) application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

Request example

curl -X GET "https://api.ampr.dev/v1/organization/members" \
  -H "Authorization: Bearer $AMPR_API_KEY"
Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.

POST /organization/members Add a member

Add an existing user to the caller's org (admin+). Enforces the role-grant ceiling: a caller cannot assign a role above their own, and only an owner may grant an owner-level membership. An unknown email returns an identical 404 (no cross-account existence oracle).

Parameters

Name In Type Required Description
X-CSRF-Token header string required Signed, session-bound CSRF token (from the `__Secure-ampr_csrf` cookie). Required on session-authenticated `POST`/`PATCH`/`DELETE`. API-key callers are exempt.

Request body

PropertyTypeRequiredDescription
emailstringformat: emailrequired
roleOrgRole
  • owner
  • admin
  • operator
  • viewer
requiredOrdinal organization role — `owner > admin > operator > viewer`.

Responses

201 Member added

PropertyTypeRequiredDescription
dataOrgMemberA member of an organization (member-management list entry).
PropertyTypeRequiredDescription
user_idstringrequired
emailstringformat: emailrequired
namestringnullable
roleOrgRole
  • owner
  • admin
  • operator
  • viewer
requiredOrdinal organization role — `owner > admin > operator > viewer`.
created_atstringformat: date-timerequired

400 Invalid request parameters application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

403 Authenticated but not authorized for this action (insufficient role) application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

404 Resource not found application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

409 Resource conflict (e.g., duplicate serial, active session) application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

Request example

curl -X POST "https://api.ampr.dev/v1/organization/members" \
  -H "Authorization: Bearer $AMPR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "string",
    "role": "admin"
  }'
Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.

DELETE /organization/members/{user_id} Remove a member

Remove a member (admin+; only an owner removes an owner; last-owner guard). Revokes that user's sessions scoped to this org. Cross-org member → 404.

Parameters

Name In Type Required Description
user_id path string required
X-CSRF-Token header string required Signed, session-bound CSRF token (from the `__Secure-ampr_csrf` cookie). Required on session-authenticated `POST`/`PATCH`/`DELETE`. API-key callers are exempt.

Responses

204 Member removed

403 Authenticated but not authorized for this action (insufficient role) application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

404 Resource not found application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

409 Resource conflict (e.g., duplicate serial, active session) application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

Request example

curl -X DELETE "https://api.ampr.dev/v1/organization/members/usr_example" \
  -H "Authorization: Bearer $AMPR_API_KEY"
Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.

PATCH /organization/members/{user_id} Change a member's role

Change a member's role (admin+). Enforces the role-grant ceiling (admin cannot promote to/self-promote to owner) and the last-owner guard. A member of another org returns an identical 404 (BOLA).

Parameters

Name In Type Required Description
user_id path string required
X-CSRF-Token header string required Signed, session-bound CSRF token (from the `__Secure-ampr_csrf` cookie). Required on session-authenticated `POST`/`PATCH`/`DELETE`. API-key callers are exempt.

Request body

PropertyTypeRequiredDescription
roleOrgRole
  • owner
  • admin
  • operator
  • viewer
requiredOrdinal organization role — `owner > admin > operator > viewer`.

Responses

200 Role updated

PropertyTypeRequiredDescription
dataobject
PropertyTypeRequiredDescription
user_idstring
roleOrgRole
  • owner
  • admin
  • operator
  • viewer
Ordinal organization role — `owner > admin > operator > viewer`.

403 Authenticated but not authorized for this action (insufficient role) application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

404 Resource not found application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

409 Resource conflict (e.g., duplicate serial, active session) application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

Request example

curl -X PATCH "https://api.ampr.dev/v1/organization/members/usr_example" \
  -H "Authorization: Bearer $AMPR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "role": "admin"
  }'
Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.

POST /organization/members/{user_id}/erase Erase a user's account (GDPR)

GDPR erasure (Ampr as controller of account PII). Cascades the user's memberships + sessions and anonymises the `users` row in place with a per-user-unique sentinel (`erased+<userId>@invalid`). Admin+; only an owner may erase an owner. Cross-org / nonexistent → identical 404 (BOLA).

Parameters

Name In Type Required Description
user_id path string required
X-CSRF-Token header string required Signed, session-bound CSRF token (from the `__Secure-ampr_csrf` cookie). Required on session-authenticated `POST`/`PATCH`/`DELETE`. API-key callers are exempt.

Responses

200 Account erased

PropertyTypeRequiredDescription
dataobject
PropertyTypeRequiredDescription
user_idstring
statusenum
  • erased

403 Authenticated but not authorized for this action (insufficient role) application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

404 Resource not found application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

Request example

curl -X POST "https://api.ampr.dev/v1/organization/members/usr_example/erase" \
  -H "Authorization: Bearer $AMPR_API_KEY"
Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.

GET /organization/members/{user_id}/export Export a user's account data (GDPR)

GDPR Right of Access / Portability. Machine-readable export of the user row, their org membership, and their session/login history, scoped to the caller's org (admin+). Cross-org / nonexistent → identical 404 (BOLA).

Parameters

Name In Type Required Description
user_id path string required

Responses

200 Account data export

PropertyTypeRequiredDescription
dataUserExportMachine-readable GDPR account-data export (Right of Access / Portability).
PropertyTypeRequiredDescription
userUserrequired
PropertyTypeRequiredDescription
idstringrequired
emailstringformat: emailrequired
namestringnullable
email_verifiedbooleanrequiredWhether the account's email has been verified. Login is gated on this in V1.
created_atstringformat: date-time
membershipsarray<Membership>required
PropertyTypeRequiredDescription
org_idstringrequired
org_namestring
roleOrgRole
  • owner
  • admin
  • operator
  • viewer
requiredOrdinal organization role — `owner > admin > operator > viewer`.
sessionsarray<object>requiredSession / login history — `ip`, `user_agent`, and timestamps are PII.
PropertyTypeRequiredDescription
ipstringnullable
user_agentstringnullable
created_atstringformat: date-time
last_seen_atstringnullableformat: date-time
expires_atstringformat: date-time
revoked_atstringnullableformat: date-time

403 Authenticated but not authorized for this action (insufficient role) application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

404 Resource not found application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

Request example

curl -X GET "https://api.ampr.dev/v1/organization/members/usr_example/export" \
  -H "Authorization: Bearer $AMPR_API_KEY"
Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.

GET /api-keys List API keys (masked)

Responses

200 API key list

PropertyTypeRequiredDescription
dataarray<ApiKey>
PropertyTypeRequiredDescription
idstringrequired
keystringnullableFull key value — only returned on creation
key_prefixstringMasked key for display (e.g., key_...b9x4)
labelstringnullablerequired
last_used_atstringnullableformat: date-time
created_atstringformat: date-timerequired

401 Missing or invalid API key application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

Request example

curl -X GET "https://api.ampr.dev/v1/api-keys" \
  -H "Authorization: Bearer $AMPR_API_KEY"
Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.

POST /api-keys Create an API key

Request body

PropertyTypeRequiredDescription
labelstringnullable

Responses

201 API key created (full key shown only once)

PropertyTypeRequiredDescription
dataApiKey
PropertyTypeRequiredDescription
idstringrequired
keystringnullableFull key value — only returned on creation
key_prefixstringMasked key for display (e.g., key_...b9x4)
labelstringnullablerequired
last_used_atstringnullableformat: date-time
created_atstringformat: date-timerequired

401 Missing or invalid API key application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

Request example

curl -X POST "https://api.ampr.dev/v1/api-keys" \
  -H "Authorization: Bearer $AMPR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "string"
  }'
Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.

DELETE /api-keys/{key_id} Revoke an API key

Parameters

Name In Type Required Description
key_id path string required

Responses

204 Key revoked

401 Missing or invalid API key application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

404 Resource not found application/problem+json

PropertyTypeRequiredDescription
typestringformat: urirequired
titlestringrequired
statusintegerrequired
detailstringnullable
instancestringnullable

Request example

curl -X DELETE "https://api.ampr.dev/v1/api-keys/key_example" \
  -H "Authorization: Bearer $AMPR_API_KEY"
Note
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.