Organization
Organization details, API keys, and member management
GET /organization Get current organization details
Responses
200 Organization detail
| Property | Type | Required | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | Organization | ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
401 Missing or invalid API key application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
Request example
curl -X GET "https://api.ampr.dev/v1/organization" \
-H "Authorization: Bearer $AMPR_API_KEY" const res = await fetch('https://api.ampr.dev/v1/organization', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
},
});
const data = await res.json(); GET /organization/members List organization members
List members of the caller's org (viewer+).
Responses
200 Member list
| Property | Type | Required | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | array<OrgMember> | ||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
401 Missing or invalid API key application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
403 Authenticated but not authorized for this action (insufficient role) application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
Request example
curl -X GET "https://api.ampr.dev/v1/organization/members" \
-H "Authorization: Bearer $AMPR_API_KEY" const res = await fetch('https://api.ampr.dev/v1/organization/members', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
},
});
const data = await res.json(); 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
| Property | Type | Required | Description |
|---|---|---|---|
email | stringformat: email | required | |
role | OrgRole
| required | Ordinal organization role — `owner > admin > operator > viewer`. |
Responses
201 Member added
| Property | Type | Required | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | OrgMember | A member of an organization (member-management list entry). | |||||||||||||||||||||||||
| |||||||||||||||||||||||||||
400 Invalid request parameters application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
403 Authenticated but not authorized for this action (insufficient role) application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
404 Resource not found application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
409 Resource conflict (e.g., duplicate serial, active session) application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
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"
}' const res = await fetch('https://api.ampr.dev/v1/organization/members', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"email": "string",
"role": "admin"
}),
});
const data = await res.json(); 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
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
404 Resource not found application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
409 Resource conflict (e.g., duplicate serial, active session) application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
Request example
curl -X DELETE "https://api.ampr.dev/v1/organization/members/usr_example" \
-H "Authorization: Bearer $AMPR_API_KEY" const res = await fetch('https://api.ampr.dev/v1/organization/members/usr_example', {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
},
});
const data = await res.json(); 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
| Property | Type | Required | Description |
|---|---|---|---|
role | OrgRole
| required | Ordinal organization role — `owner > admin > operator > viewer`. |
Responses
200 Role updated
| Property | Type | Required | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | object | ||||||||||||||
| |||||||||||||||
403 Authenticated but not authorized for this action (insufficient role) application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
404 Resource not found application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
409 Resource conflict (e.g., duplicate serial, active session) application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
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"
}' const res = await fetch('https://api.ampr.dev/v1/organization/members/usr_example', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"role": "admin"
}),
});
const data = await res.json(); 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
| Property | Type | Required | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | object | ||||||||||||||
| |||||||||||||||
403 Authenticated but not authorized for this action (insufficient role) application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
404 Resource not found application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
Request example
curl -X POST "https://api.ampr.dev/v1/organization/members/usr_example/erase" \
-H "Authorization: Bearer $AMPR_API_KEY" const res = await fetch('https://api.ampr.dev/v1/organization/members/usr_example/erase', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
},
});
const data = await res.json(); 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
| Property | Type | Required | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | UserExport | Machine-readable GDPR account-data export (Right of Access / Portability). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
403 Authenticated but not authorized for this action (insufficient role) application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
404 Resource not found application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
Request example
curl -X GET "https://api.ampr.dev/v1/organization/members/usr_example/export" \
-H "Authorization: Bearer $AMPR_API_KEY" const res = await fetch('https://api.ampr.dev/v1/organization/members/usr_example/export', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
},
});
const data = await res.json(); GET /api-keys List API keys (masked)
Responses
200 API key list
| Property | Type | Required | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | array<ApiKey> | ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
401 Missing or invalid API key application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
Request example
curl -X GET "https://api.ampr.dev/v1/api-keys" \
-H "Authorization: Bearer $AMPR_API_KEY" const res = await fetch('https://api.ampr.dev/v1/api-keys', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
},
});
const data = await res.json(); POST /api-keys Create an API key
Request body
| Property | Type | Required | Description |
|---|---|---|---|
label | stringnullable |
Responses
201 API key created (full key shown only once)
| Property | Type | Required | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | ApiKey | ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
401 Missing or invalid API key application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
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"
}' const res = await fetch('https://api.ampr.dev/v1/api-keys', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"label": "string"
}),
});
const data = await res.json(); 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
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
404 Resource not found application/problem+json
| Property | Type | Required | Description |
|---|---|---|---|
type | stringformat: uri | required | |
title | string | required | |
status | integer | required | |
detail | stringnullable | ||
instance | stringnullable | ||
code | string | Stable machine-readable problem code, present on problems a client is expected to branch on (for example `org_payments_not_ready`, `driver_erased`, `token_already_linked`, `payment_method_not_active`, `idempotency_key_required`, `idempotency_key_reused`, `provider_unavailable`, `publishable_key_not_configured`). |
Request example
curl -X DELETE "https://api.ampr.dev/v1/api-keys/key_example" \
-H "Authorization: Bearer $AMPR_API_KEY" const res = await fetch('https://api.ampr.dev/v1/api-keys/key_example', {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.AMPR_API_KEY}`,
},
});
const data = await res.json();