Link copied to clipboard!
Mobile navigation button - closed state

Organizations

All available operations for manipulating organizations and their information


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>

Request Body

Field
name string required on create
Organization name
status string optional
active OR deleted
members (string | number)[] optional
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"]
  }'

If successful, the response will be:

{
  "success": true
}

Update organization members

Use this 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

Request Body

Field Type Description
add (string | number)[] optional List of partner-specific IDs of the users who should be added as members to this organization
remove (string | number)[] optional List of partner-specific IDs of the users who should be removed as members from this organization

Example request to add one member and remove another

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"]
  }'

If successful, the response will be:

{
  "success": true
}

List organizations

This endpoint lists all organizations created in the context of your application.

HTTP Request

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

Example request to gets the list of organizations:

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

Example response:

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

Get organization details

HTTP Request

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

Example request to get details for a organization:

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

If the organization exists, the response will be:

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

Next up