Organization
Organization details, API keys, and member management
GET /organization Get current organization details
Responses
401 Missing or invalid API key application/problem+json
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();
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
401 Missing or invalid API key application/problem+json
403 Authenticated but not authorized for this action (insufficient role) application/problem+json
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();
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
Request body
Responses
400 Invalid request parameters application/problem+json
403 Authenticated but not authorized for this action (insufficient role) application/problem+json
404 Resource not found application/problem+json
409 Resource conflict (e.g., duplicate serial, active session) application/problem+json
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();
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
Responses
403 Authenticated but not authorized for this action (insufficient role) application/problem+json
404 Resource not found application/problem+json
409 Resource conflict (e.g., duplicate serial, active session) application/problem+json
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();
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
Request body
Responses
403 Authenticated but not authorized for this action (insufficient role) application/problem+json
404 Resource not found application/problem+json
409 Resource conflict (e.g., duplicate serial, active session) application/problem+json
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();
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
Responses
403 Authenticated but not authorized for this action (insufficient role) application/problem+json
404 Resource not found application/problem+json
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();
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
Responses
403 Authenticated but not authorized for this action (insufficient role) application/problem+json
404 Resource not found application/problem+json
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();
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.
GET /api-keys List API keys (masked)
Responses
401 Missing or invalid API key application/problem+json
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();
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
Responses
201 API key created (full key shown only once)
401 Missing or invalid API key application/problem+json
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();
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
Responses
401 Missing or invalid API key application/problem+json
404 Resource not found application/problem+json
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();
This endpoint requires an API key. Send it as a Bearer token in the Authorization header.