Batch

Using a single API call to update multiple users and organizations


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

Use this for cases where you need to take actions on several organizations or users at once. The action taken for each entity is 'create or update': If an existing user or organization with that ID exists, it will be updated with the provided data.

HTTP Request #

POST https://api.cord.com/v1/batch
Copy

Request Body #

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


users
optional
Partial<Omit<ServerUserData, "id" | "createdTimestamp">> & { id: ID; }[]
List of user objects. Every object must include the id field. If the user already exists, all other fields are optional and only updated when present. If the user does not already exist, fields are required as described in the Create or update a user API.

organizations
optional
Partial<Omit<ServerOrganizationData, "id">> & { id: ID; }[]
List of organization objects. Every object must include the id field. If the organization already exists, all other fields are optional and only updated when present. If the organization does not already exist, fields are required as described in the Create or update an organization API.

Deleting users

To remove a user across your application, Cord's data model includes a status field on the User object. If that value is set as deleted, the user will no longer be able to use Cord. This means they won't be able to load Cord components, be marked as present, view past conversations, etc.. The user will also disappear from any facepiles they were previously shown in. However, any messages they've sent will still exist. This applies across all organizations that the user was a member of.

Setting the status field to active reverses this change, causing the user to reappear where they had previously been present and allowing the user to login and use Cord again.

You may want to remove a user from a particular Organization rather than removing them from across the application. For more information on this, see the Organization API.

Example Request #

curl "https://api.cord.com/v1/batch" -X POST -H "Authorization: Bearer <ACCESS_TOKEN>" -H "Content-Type: application/json" -d '{
  "organizations": [
    {
      "id": "10",
      "name": "Planet Express",
      "members": ["4", "42"]
    }
  ],
  "users": [
    {
      "id": "4",
      "name": "Hubert Farnsworth",
      "email": "hubert@planetexpress.nny"
    },
    {
      "id": "42",
      "name": "Leela Turanga",
      "email": "leela@planetexpress.nny"
    }
  ]
}'
Copy

Ask Cordy