Organizations

All available operations for manipulating organizations and their information


Check out our integration guide to understand how user syncing fits in your backend workflow

Create or update an organization #

This endpoint creates or updates an organization:

  • if the organization does not exist in the Cord backend (based on its ID), it will be created; some fields are required.
  • if the organization exists, it will be updated: all fields are optional, only the fields provided will be updated; if the request is updating the members list, the list is treated as exhaustive: all member user IDs must be included, previous members who are not in the list will be removed.

HTTP Request #

PUT https://api.cord.com/v1/organizations/<ID>
Copy

For more information about IDs, check out our Identifiers concept breakdown.

Request Body #

Listed below are the fields of the request body to be added as part of the HTTP PUT request.


name
optional
string
Organization name

status
optional
"active" | "deleted"
Whether this organization is active or deleted. Attempting to log into a deleted organization will fail.

members
optional
(string | number)[]
List of partner-specific IDs of the users who are members of this organization

Example Request #

curl "https://api.cord.com/v1/organizations/456" \
-X PUT \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
  "name": "Planet Express",
  "members": ["4", "42"]
}'
Copy

If successful, the response will be:

{
"success": true
}
Copy

Update organization members #

Use this endpoint to add and/or remove members from an organization.

Requests to add a user that is already a member of that organization, or remove a user that is not a member, will have no effect (but will not return an error).

Note: It is an error to add and remove the same user in a single request.

HTTP Request #

POST https://api.cord.com/v1/organizations/<ID>/members
Copy

Request Body #

Listed below are the fields of the request body to be added as part of the HTTP POST request.


add
optional
(string | number)[]
The IDs of users to add to this organization.

remove
optional
(string | number)[]
The IDs of users to remove from this organization.

Example Request #

curl "https://api.cord.com/v1/organizations/456/members" \
  -X POST \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "add": ["4"],
    "remove": ["42"]
  }'
Copy

If successful, the response will be:

[
  {
    "id": "3001",
    "name": "Philip J Fry",
    "email": "delivery@planetexpress.nny",
    "first_name": "Philip",
    "last_name": "Fry"
  },
  {
    "id": "123",
    "name": "Bender Bending Rodriguez",
    "email": "bending@planetexpress.nny"
  }
]
Copy

List organizations #

Use this endpoint to list all organizations that you have created within your Cord application.

HTTP Request #

GET https://api.cord.com/v1/organizations
Copy

Request Body #

This endpoint does not require a request body.

Response #

The response is an object containing the information about the organizations:


name
string
Organization name

id
string | number
ID of the organization

status
"active" | "deleted"
Whether this organization is active or deleted. Attempting to log into a deleted organization will fail.

Example Request #

curl "https://api.cord.com/v1/organizations" \
  -H "Authorization: Bearer <ACCESS_TOKEN>"
Copy

If successful, the response will be:

[
  {
    "id": "10",
    "name": "Planet Express"
  }
]
Copy

Get organization details #

HTTP Request #

GET https://api.cord.com/v1/organizations/<ID>
Copy

For more information about IDs, check out our Identifiers concept breakdown.

Request Body #

This endpoint does not require a request body.

Response #

The response is a JSON Object with the following fields:


id
string | number
ID of the organization

name
string
Organization name

status
"active" | "deleted"
Whether this organization is active or deleted. Attempting to log into a deleted organization will fail.

members
(string | number)[]
List of partner-specific IDs of the users who are members of this organization

Example Request #

curl "https://api.cord.com/v1/organizations" \
  -H "Authorization: Bearer <ACCESS_TOKEN>"
Copy

If the request is successful and the organization exists, the response payload will be of the form:

{
  "id": "10",
  "name": "Planet Express",
  "members": ["4", "42"]
}
Copy

Delete an organization #

This endpoint will permanently delete an organization and associated data. This operation will delete all threads and message associated with the organization. Please only use this endpoint if you are okay with that. Users will not be deleted because users can be in multiple organizations. However, deleting the organization also removes all users from the organization.

HTTP Request #

DELETE https://api.cord.com/v1/organizations/<ID>
Copy

For more information about IDs, check out our Identifiers concept breakdown.

Request Body #

This endpoint does not require a request body.

Example Request #

curl -X DELETE "https://api.cord.com/v1/organizations/<id>" \
  -H "Authorization: Bearer <ACCESS_TOKEN>"
Copy

If the request is successful and the organization is now deleted, the response payload will be of the form:

{
  "success": true,
}
Copy

Ask Cordy