Skip to Content
API ReferenceOrganizations

Organizations

Manage your organization settings and team members. All API requests are scoped to a single organization based on the authenticated user’s membership.

Get Current Organization

GET/api/v1/organizations

Retrieve the current organization's details.

Any authenticated user

Returns the organization associated with the current authentication context, including settings, plan, and usage.

curl -X GET "https://api.orderly-hub.com/api/v1/organizations" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \ -H "X-Organization-Id: your-org-id"

Response

{ "data": { "id": "uuid", "name": "Acme Fulfillment", "slug": "acme-fulfillment", "plan": "pro", "settings": { "timezone": "America/New_York", "default_currency": "USD" }, "created_at": "2025-06-01T00:00:00Z" } }

Update Current Organization

PATCH/api/v1/organizations

Update the current organization's settings.

Admin or Owner

Updates the organization’s name, settings, or other configurable properties. Only users with the Admin or Owner role can update the organization.

Request Body

FieldTypeDescription
namestringOrganization display name
settingsobjectOrganization-wide settings
curl -X PATCH "https://api.orderly-hub.com/api/v1/organizations" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \ -H "X-Organization-Id: your-org-id" \ -H "Content-Type: application/json" \ -d '{ "name": "Acme Fulfillment Inc.", "settings": { "timezone": "America/Los_Angeles" } }'

List Members

GET/api/v1/organizations/members

List all members of the current organization.

Any authenticated user

Returns all users who are members of the current organization, including their roles.

curl -X GET "https://api.orderly-hub.com/api/v1/organizations/members" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \ -H "X-Organization-Id: your-org-id"

Response

{ "data": [ { "id": "uuid", "first_name": "Jane", "last_name": "Doe", "email": "jane@acme.com", "role": "owner", "created_at": "2025-06-01T00:00:00Z" }, { "id": "uuid", "first_name": "Bob", "last_name": "Smith", "email": "bob@acme.com", "role": "member", "created_at": "2025-07-15T00:00:00Z" } ] }

Invite Member

POST/api/v1/organizations/members/invite

Send an email invitation to join the organization.

Admin, Owner, or Manager

Creates a pending invitation and sends a branded email via Resend with a link to accept. Invitations expire after 7 days.

Request Body

FieldTypeRequiredDescription
emailstringYesEmail address to invite
rolestringNoRole to assign: member (default), organization_manager, manager
curl -X POST "https://api.orderly-hub.com/api/v1/organizations/members/invite" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \ -H "X-Organization-Id: your-org-id" \ -H "Content-Type: application/json" \ -d '{ "email": "alice@acme.com", "role": "member" }'

Response (201)

{ "data": { "id": "uuid", "email": "alice@acme.com", "role": "member", "expiresAt": "2026-03-29T00:00:00Z" } }

Errors

StatusDescription
409User is already a member of this organization
409A pending invitation already exists for this email

List Pending Invitations

GET/api/v1/organizations/members/invitations

List all pending invitations for the current organization.

Any authenticated user

Returns invitations with status = 'pending' for the current organization.

curl -X GET "https://api.orderly-hub.com/api/v1/organizations/members/invitations" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \ -H "X-Organization-Id: your-org-id"

Response

{ "data": [ { "id": "uuid", "email": "alice@acme.com", "role": "member", "status": "pending", "invited_by": "uuid", "expires_at": "2026-03-29T00:00:00Z", "created_at": "2026-03-22T00:00:00Z" } ] }

Accept Invitation

POST/api/v1/organizations/members/invite/:token/accept

Accept a pending invitation.

Authenticated user (email must match)

Validates the invitation token, verifies the logged-in user’s email matches, creates an organization_members row, and marks the invitation as accepted.

curl -X POST "https://api.orderly-hub.com/api/v1/organizations/members/invite/abc123token/accept" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."

Response

{ "data": { "organizationId": "uuid", "role": "member" } }

Errors

StatusDescription
404Invitation not found or already used
410Invitation has expired
403Email mismatch — invitation was sent to a different email

Revoke Invitation

DELETE/api/v1/organizations/members/invite/:id

Revoke a pending invitation.

Admin, Owner, or Manager

Sets the invitation status to revoked. The invite link will no longer work.

curl -X DELETE "https://api.orderly-hub.com/api/v1/organizations/members/invite/invitation-uuid" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \ -H "X-Organization-Id: your-org-id"

Response

{ "success": true }

Remove Member

DELETE/api/v1/organizations/members/:userId

Remove a member from the organization.

Admin, Owner, or Manager

Removes the user from the organization. Cannot remove the organization owner.

curl -X DELETE "https://api.orderly-hub.com/api/v1/organizations/members/user-uuid" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \ -H "X-Organization-Id: your-org-id"

Response

{ "success": true }