Organization Memberships

A membership links a user to an organization. Organizations can have many users. Users can be in many organizations if the account supports multiple organizations. You can use the API to list users in an organization, and reassign organization members.

JSON Format

Organization memberships have the following properties:

Name Type Read-only Mandatory Comment
id integer yes no Automatically assigned when the membership is created
url string yes no The API url of this membership
user_id integer yes yes The ID of the user for whom this memberships belongs
organization_id integer yes yes The ID of the organization associated with this user, in this membership
default boolean no yes Denotes whether this is the default organization membership for the user. If false, returns null
created_at date yes no When this record was created
updated_at date yes no When this record last got updated

List Memberships

GET /api/v2/organization_memberships.json

GET /api/v2/users/{user_id}/organization_memberships.json

GET /api/v2/organizations/{organization_id}/organization_memberships.json

Returns a list of all organization memberships for the account, user or organization in question.

Note: In the case of user, organization memberships are sorted by default and name. We are not doing this sorting order on the account-wide endpoint.

Allowed For:
  • Agents
Using curl
curl https://{subdomain}.zendesk.com/api/v2/organization_memberships.json \
  -v -u {email_address}:{password}
Example Response
Status: 200 OK

{
  "organization_memberships": [
    {
      "id":              4,
      "user_id":         29,
      "organization_id": 12,
      "default":         true,
      "created_at":      "2009-05-13T00:07:08Z",
      "updated_at":      "2011-07-22T00:11:12Z"
    },
    {
      "id":              49,
      "user_id":         155,
      "organization_id": 3,
      "default":         null,
      "created_at":      "2012-03-13T22:01:32Z",
      "updated_at":      "2012-03-13T22:01:32Z"
    }
  ]
}

Show Membership

GET /api/v2/organization_memberships/{id}.json

GET /api/v2/users/{user_id}/organization_memberships/{id}.json

Shows a specific organization membership.

Allowed For
  • End Users
Using curl
curl https://{subdomain}.zendesk.com/api/v2/organization_memberships/{id}.json \
  -v -u {email_address}:{password}
Example Response
Status: 200 OK

{
  "organization_membership": {
     "id":              4,
     "user_id":         29,
     "organization_id": 12,
     "default":         true,
     "created_at":      "2009-05-13T00:07:08Z",
     "updated_at":      "2011-07-22T00:11:12Z"
  }
}

Create Membership

POST /api/v2/organization_memberships.json

POST /api/v2/users/{user_id}/organization_memberships.json

Assigns a user to a given organization.

Allowed For
  • Agents
Using curl
curl https://{subdomain}.zendesk.com/api/v2/organization_memberships.json \
  -X POST -d '{"organization_membership": {"user_id": 72, "organization_id": 88}}' \
  -H "Content-Type: application/json" -v -u {email_address}:{password}
Example Response
Status: 201 Created
Location: https://{subdomain}.zendesk.com/api/v2/organization_memberships/{id}.json

{
  "organization_membership": {
     "id":              461,
     "user_id":         72,
     "organization_id": 88,
     "default":         true,
     "created_at":      "2012-04-03T12:34:01Z",
     "updated_at":      "2012-04-03T12:34:01Z"
  }
}

Create Many Memberships

POST /api/v2/organization_memberships/create_many.json

Allowed For
  • Agents
Using curl
curl https://{subdomain}.zendesk.com/api/v2/organization_memberships/create_many.json \
  -H "Content-Type: application/json" \
  -d '{"organization_memberships": [{"user_id": 72, "organization_id": 88}, {"user_id": 27, "organization_id": 88}]}' \
  -v -u {email_address}:{password} -X POST
Example Response

This endpoint returns a job_status JSON object and queues a background job to do the work. Use the Show Job Status endpoint to check for the job's completion.

Delete Membership

DELETE /api/v2/organization_memberships/{id}.json

DELETE /api/v2/users/{user_id}/organization_memberships/{id}.json

Immediately removes a user from a organization and schedules a job to unassign all working tickets that are assigned to the given user and organization combination.

Allowed For
  • Agents
Using curl
curl https://{subdomain}.zendesk.com/api/v2/organization_memberships/{id}.json \
  -v -u {email_address}:{password} -X DELETE
Example Response
Status: 204 No Content

Bulk Delete Memberships

DELETE /api/v2/organization_memberships/destroy_many.json?ids={ids}

Immediately removes a user from a organization and schedules a job to unassign all working tickets that are assigned to the given user and organization combination

Allowed For
  • Agents
Using curl
curl https://{subdomain}.zendesk.com/api/v2/organization_memberships/destroy_many.json?ids=1,2,3 \
  -v -u {email_address}:{password} -X DELETE
Example Response

This endpoint returns a job_status JSON object and queues a background job to do the work. Use the Show Job Status endpoint to check for the job's completion.

Set Membership as Default

PUT /api/v2/users/{id}/organization_memberships/{membership_id}/make_default.json

Sets the default organization membership of a given user.

Allowed For
  • Agents
Using curl
curl https://{subdomain}.zendesk.com/api/v2/users/{user_id}/organization_memberships/{org_membership_id}/make_default.json \
  -v -u {email_address}:{password} -X PUT -d '{}' -H "Content-Type: application/json"
Example Response

Same as List Memberships