Skip to Content
Documentation

Organizations

Organizations, members, roles and invitations.

/organization/create

POST
/organization/create

Create an organization

Request Body

application/json
  1. body
name*string

The name of the organization

Length1 <= length
slug*string

The slug of the organization

Length1 <= length
userId?string

The user id of the organization creator. If not provided, the current user will be used. Should only be used by admins or when called by the server. server-only. Eg: "user-id"

logo?|

The logo of the organization

metadata?

The metadata of the organization

keepCurrentActiveOrganization?boolean

Whether to keep the current active organization active after creating a new one. Eg: true

Response Body

Success

application/json
  1. response

The organization that was created

id*string
name*string
slug*string
logo?string
createdAt*string
Formatdate-time
metadata?string
Example Request
curl -X POST 'https://auth.example.com/api/auth/organization/create' \  -H 'Content-Type: application/json' \  -d '{  "name": "string",  "slug": "string"}'
Example Response
{  "id": "string",  "name": "string",  "slug": "string",  "logo": "string",  "createdAt": "2019-08-24T14:15:22Z",  "metadata": "string"}

/organization/update

POST
/organization/update

Update an organization

Request Body

application/json
  1. body
data*
organizationId?string

The organization ID. Eg: "org-id"

Response Body

Success

application/json
  1. response

The updated organization

id*string
name*string
slug*string
logo?string
createdAt*string
Formatdate-time
metadata?string
Example Request
curl -X POST 'https://auth.example.com/api/auth/organization/update' \  -H 'Content-Type: application/json' \  -d '{  "data": {}}'
Example Response
{  "id": "string",  "name": "string",  "slug": "string",  "logo": "string",  "createdAt": "2019-08-24T14:15:22Z",  "metadata": "string"}

/organization/delete

POST
/organization/delete

Delete an organization

Request Body

application/json
  1. body
organizationId*string

The organization id to delete

Response Body

Success

response?stringapplication/json

The organization id that was deleted

Example Request
curl -X POST 'https://auth.example.com/api/auth/organization/delete' \  -H 'Content-Type: application/json' \  -d '{  "organizationId": "string"}'
Example Response
"string"

Set Active Organization

POST
/organization/set-active

Set the active organization

Request Body

application/json
  1. body
organizationId?|

The organization id to set as active. It can be null to unset the active organization. Eg: "org-id"

organizationSlug?string

The organization slug to set as active. It can be null to unset the active organization if organizationId is not provided. Eg: "org-slug"

Response Body

Success

application/json
  1. response

The organization

id*string
name*string
slug*string
logo?string
createdAt*string
Formatdate-time
metadata?string
Example Request
curl -X POST 'https://auth.example.com/api/auth/organization/set-active' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "id": "string",  "name": "string",  "slug": "string",  "logo": "string",  "createdAt": "2019-08-24T14:15:22Z",  "metadata": "string"}

Get Organization

GET
/organization/get-organization

Get the organization metadata

Query Parameters

organizationId?string

The organization id to get

organizationSlug?string

The organization slug to get

Response Body

Success

application/json
  1. response

The organization

id*string
name*string
slug*string
logo?string
createdAt*string
Formatdate-time
metadata?string
Example Request
curl -X GET 'https://auth.example.com/api/auth/organization/get-organization'
Example Response
{  "id": "string",  "name": "string",  "slug": "string",  "logo": "string",  "createdAt": "2019-08-24T14:15:22Z",  "metadata": "string"}

Get Full Organization

GET
/organization/get-full-organization

Get the full organization

Query Parameters

organizationId?string

The organization id to get

organizationSlug?string

The organization slug to get

membersLimit?|

The limit of members to get. By default, it uses the membershipLimit option.

Response Body

Success

application/json
  1. response

The organization

id*string
name*string
slug*string
logo?string
createdAt*string
Formatdate-time
metadata?string
Example Request
curl -X GET 'https://auth.example.com/api/auth/organization/get-full-organization'
Example Response
{  "id": "string",  "name": "string",  "slug": "string",  "logo": "string",  "createdAt": "2019-08-24T14:15:22Z",  "metadata": "string"}

/organization/list

GET
/organization/list

List all organizations

Response Body

Success

application/json
  1. response
[index: integer]?
Example Request
curl -X GET 'https://auth.example.com/api/auth/organization/list'
Example Response
[  {    "id": "string",    "name": "string",    "slug": "string",    "logo": "string",    "createdAt": "2019-08-24T14:15:22Z",    "metadata": "string"  }]
POST
/organization/invite-member

Create an invitation to an organization

Request Body

application/json
  1. body
email*string

The email address of the user to invite

role*|array<>

The role(s) to assign to the user. It can be admin, member, owner. Eg: "member"

organizationId?string

The organization ID to invite the user to

resend?boolean

Resend the invitation email, if the user is already invited. Eg: true

teamId?|array<string>

Response Body

Success

application/json
  1. response
id*string
email*string
role*string
organizationId*string
inviterId*string
status*string
expiresAt*string
createdAt*string
Example Request
curl -X POST 'https://auth.example.com/api/auth/organization/invite-member' \  -H 'Content-Type: application/json' \  -d '{  "email": "string",  "role": "string"}'
Example Response
{  "id": "string",  "email": "string",  "role": "string",  "organizationId": "string",  "inviterId": "string",  "status": "string",  "expiresAt": "string",  "createdAt": "string"}
POST
/organization/cancel-invitation

Request Body

application/json
  1. body
invitationId*string

The ID of the invitation to cancel

Response Body

Bad Request. Usually due to missing parameters, or invalid parameters.

application/json
  1. response
message*string
Example Request
curl -X POST 'https://auth.example.com/api/auth/organization/cancel-invitation' \  -H 'Content-Type: application/json' \  -d '{  "invitationId": "string"}'
Example Response
{  "message": "string"}
POST
/organization/accept-invitation

Accept an invitation to an organization

Request Body

application/json
  1. body
invitationId*string

The ID of the invitation to accept

Response Body

Success

application/json
  1. response
invitation?
member?
Example Request
curl -X POST 'https://auth.example.com/api/auth/organization/accept-invitation' \  -H 'Content-Type: application/json' \  -d '{  "invitationId": "string"}'
Example Response
{  "invitation": {},  "member": {}}
GET
/organization/get-invitation

Get an invitation by ID

Query Parameters

id?string

The ID of the invitation to get

Response Body

Success

application/json
  1. response
id*string
email*string
role*string
organizationId*string
inviterId*string
status*string
expiresAt*string
organizationName*string
organizationSlug*string
inviterEmail*string
Example Request
curl -X GET 'https://auth.example.com/api/auth/organization/get-invitation'
Example Response
{  "id": "string",  "email": "string",  "role": "string",  "organizationId": "string",  "inviterId": "string",  "status": "string",  "expiresAt": "string",  "organizationName": "string",  "organizationSlug": "string",  "inviterEmail": "string"}
POST
/organization/reject-invitation

Reject an invitation to an organization

Request Body

application/json
  1. body
invitationId*string

The ID of the invitation to reject

Response Body

Success

application/json
  1. response
invitation?
member?
Example Request
curl -X POST 'https://auth.example.com/api/auth/organization/reject-invitation' \  -H 'Content-Type: application/json' \  -d '{  "invitationId": "string"}'
Example Response
{  "invitation": {},  "member": {}}
GET
/organization/list-invitations

Query Parameters

organizationId?string

The ID of the organization to list invitations for

Response Body

Bad Request. Usually due to missing parameters, or invalid parameters.

application/json
  1. response
message*string
Example Request
curl -X GET 'https://auth.example.com/api/auth/organization/list-invitations'
Example Response
{  "message": "string"}
GET
/organization/get-active-member

Get the member details of the active organization

Response Body

Success

application/json
  1. response
id*string
userId*string
organizationId*string
role*string
Example Request
curl -X GET 'https://auth.example.com/api/auth/organization/get-active-member'
Example Response
{  "id": "string",  "userId": "string",  "organizationId": "string",  "role": "string"}

/organization/check-slug

POST
/organization/check-slug

Request Body

application/json
  1. body
slug*string

The organization slug to check. Eg: "my-org"

Response Body

Bad Request. Usually due to missing parameters, or invalid parameters.

application/json
  1. response
message*string
Example Request
curl -X POST 'https://auth.example.com/api/auth/organization/check-slug' \  -H 'Content-Type: application/json' \  -d '{  "slug": "string"}'
Example Response
{  "message": "string"}
POST
/organization/remove-member

Remove a member from an organization

Request Body

application/json
  1. body
memberIdOrEmail*string

The ID or email of the member to remove

organizationId?string

The ID of the organization to remove the member from. If not provided, the active organization will be used. Eg: "org-id"

Response Body

Success

application/json
  1. response
member*
Example Request
curl -X POST 'https://auth.example.com/api/auth/organization/remove-member' \  -H 'Content-Type: application/json' \  -d '{  "memberIdOrEmail": "string"}'
Example Response
{  "member": {    "id": "string",    "userId": "string",    "organizationId": "string",    "role": "string"  }}
POST
/organization/update-member-role

Update the role of a member in an organization

Request Body

application/json
  1. body
role*|array<string>

The new role to be applied. This can be a string or array of strings representing the roles. Eg: ["admin", "sale"]

memberId*string

The member id to apply the role update to. Eg: "member-id"

organizationId?string

An optional organization ID which the member is a part of to apply the role update. If not provided, you must provide session headers to get the active organization. Eg: "organization-id"

Response Body

Success

application/json
  1. response
member*
Example Request
curl -X POST 'https://auth.example.com/api/auth/organization/update-member-role' \  -H 'Content-Type: application/json' \  -d '{  "role": "string",  "memberId": "string"}'
Example Response
{  "member": {    "id": "string",    "userId": "string",    "organizationId": "string",    "role": "string"  }}

/organization/leave

POST
/organization/leave

Request Body

application/json
  1. body
organizationId*string

The organization Id for the member to leave. Eg: "organization-id"

Response Body

Bad Request. Usually due to missing parameters, or invalid parameters.

application/json
  1. response
message*string
Example Request
curl -X POST 'https://auth.example.com/api/auth/organization/leave' \  -H 'Content-Type: application/json' \  -d '{  "organizationId": "string"}'
Example Response
{  "message": "string"}
GET
/organization/list-user-invitations

List all invitations a user has received

Query Parameters

email?string

The email of the user to list invitations for. This only works for server side API calls.

Response Body

Success

application/json
  1. response
[index: integer]?
Example Request
curl -X GET 'https://auth.example.com/api/auth/organization/list-user-invitations'
Example Response
[  {    "id": "string",    "email": "string",    "role": "string",    "organizationId": "string",    "organizationName": "string",    "inviterId": "string",    "teamId": "string",    "status": "string",    "expiresAt": "string",    "createdAt": "string"  }]
GET
/organization/list-members

Query Parameters

limit?|number
offset?|number
sortBy?string

The field to sort by

sortDirection?string

The direction to sort by

Value in"asc""desc"
filterField?string

The field to filter by

filterValue?|number|boolean|array<string>|array<number>
filterOperator?string

The operator to use for the filter

Value in"eq""ne""lt""lte""gt""gte""in""not_in""contains""starts_with""ends_with"
organizationId?string

The organization ID to list members for. If not provided, will default to the user's active organization. Eg: "organization-id"

organizationSlug?string

The organization slug to list members for. If not provided, will default to the user's active organization. Eg: "organization-slug"

Response Body

Bad Request. Usually due to missing parameters, or invalid parameters.

application/json
  1. response
message*string
Example Request
curl -X GET 'https://auth.example.com/api/auth/organization/list-members'
Example Response
{  "message": "string"}
GET
/organization/get-active-member-role

Query Parameters

userId?string

The user ID to get the role for. If not provided, will default to the current user's

organizationId?string

The organization ID to list members for. If not provided, will default to the user's active organization. Eg: "organization-id"

organizationSlug?string

The organization slug to list members for. If not provided, will default to the user's active organization. Eg: "organization-slug"

Response Body

Bad Request. Usually due to missing parameters, or invalid parameters.

application/json
  1. response
message*string
Example Request
curl -X GET 'https://auth.example.com/api/auth/organization/get-active-member-role'
Example Response
{  "message": "string"}
POST
/organization/has-permission

Check if the user has permission

Request Body

application/json
  1. body
permission?Deprecated

The permission to check

permissions*

The permission to check

Response Body

Success

application/json
  1. response
error?string
success*boolean
Example Request
curl -X POST 'https://auth.example.com/api/auth/organization/has-permission' \  -H 'Content-Type: application/json' \  -d '{  "permissions": {}}'
Example Response
{  "error": "string",  "success": true}