Create an account membership
Identity module
POST/account-membershipsaccountMemberships.create
A person in an external organization's account. Creates an account membership. Requires `Idempotency-Key`; a replay returns the original response. The organization is derived from the credential or the parent row, never from the body.
- Requires the capability me.account.write.
- OAuth scopes: me.
- Send an Idempotency-Key header. A replay with the same key returns the original response.
- Error statuses: 400, 401, 409, 422, 429. Errors are RFC 9457 problem details.
Request body: AccountMembershipCreate
| Field | Type | Required | Description |
|---|---|---|---|
| person_id | string (uuid) | Yes | Identifier of the member. |
| account_role | AccountRole | Yes | Role inside an external account.Constraints: one of "Account Owner", "Account Admin", "Account Finance", "Account Member" |
{
"person_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
"account_role": "Account Finance"
}Response 201: AccountMembership
| Field | Type | Required | Description |
|---|---|---|---|
| id | string (uuid) | Yes | Identifier of the account membership. |
| created_at | string (date-time) | Yes | When the row was created. |
| updated_at | string (date-time) | Yes | When the row was last updated. |
| person_id | string (uuid) | Yes | Identifier of the member. |
| valid_from | string (date-time) | Yes | Start of account membership. |
| valid_to | string (date-time) | null | Yes | End of account membership. |
{
"id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
"created_at": "2026-10-08T14:30:00Z",
"updated_at": "2026-10-08T14:30:00Z",
"person_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
"valid_from": "2026-10-08T14:30:00Z",
"valid_to": "2026-10-08T14:30:00Z"
}Code samples
curl -X POST "$XOS_BASE_URL/account-memberships" \
-H "Authorization: Bearer $XOS_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"person_id":"0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f","account_role":"Account Finance"}'const { data } = await xos.accountMemberships.create({
"person_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f",
"account_role": "Account Finance"
});response = xos.account_memberships.create({"person_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f", "account_role": "Account Finance"})xos account-memberships create --data '{"person_id":"0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f","account_role":"Account Finance"}'