Skip to content

Organizations

Organizations let you group users within an environment. Users join organizations through memberships and can be assigned organization-level roles.

Terminal window
curl -X POST https://acme-test.paylent.com/api/organizations \
-H "Content-Type: application/vnd.api+json" \
-d '{
"data": {
"type": "organization",
"attributes": {
"name": "Acme Corp"
}
}
}'

A membership links a user to an organization. Each user can only have one membership per organization.

Terminal window
curl -X POST https://acme-test.paylent.com/api/memberships \
-H "Content-Type: application/vnd.api+json" \
-d '{
"data": {
"type": "membership",
"attributes": {},
"relationships": {
"user": { "data": { "type": "user", "id": "USER_ID" } },
"organization": { "data": { "type": "organization", "id": "ORG_ID" } }
}
}
}'

Memberships can be assigned roles (via membership_role), allowing organization-level permission structures separate from environment-level roles.

Invite users to join an organization by email. Invitations include:

  • Target email address
  • Role IDs to assign on acceptance
  • Expiry timestamp
  • Invitation status tracking
Terminal window
curl -X POST https://acme-test.paylent.com/api/invitations \
-H "Content-Type: application/vnd.api+json" \
-d '{
"data": {
"type": "invitation",
"attributes": {
"email": "[email protected]",
"role_ids": ["ROLE_ID_1", "ROLE_ID_2"]
},
"relationships": {
"organization": { "data": { "type": "organization", "id": "ORG_ID" } }
}
}
}'
StatusDescription
pendingInvitation sent, awaiting response
acceptedUser accepted and joined the organization
declinedUser declined the invitation
revokedInvitation was revoked by an admin

Only one pending invitation can exist per email per organization. Invitations can be accepted or declined via dedicated endpoints:

Terminal window
POST /invitations/:id/accept
POST /invitations/:id/decline