Space Memberships

Group Space Memberships

Space memberships represent the relationship between a single Contentful user and a space within your organization. In other words, they are the data object that defines explicitly who is a member of which space.

Get all space memberships in a space

Get all space memberships in a space

This endpoint returns a paginated list of all the space memberships in a space.

All space members can access this endopint.

Query Parameters

NameDetailsDescription
skip, limit-Specify requested page of result set. See Pagination for more details.
includeSupported values: sys.userSpecify linked resources to include in response. See Including Related Resources for more details.

Response

1{
2 "total": 1,
3 "limit": 25,
4 "skip": 0,
5 "sys": {
6 "type": "Array"
7 },
8 "items": [
9 {
10 "admin": false,
11 "sys": {
12 "type": "SpaceMembership",
13 "id": "jn066pnp3hgr-7uqvFPPLzgtVaezGvjA9U6",
14 "version": 0,
15 "createdAt": "2013-04-11T20:04:37Z",
16 "updatedAt": "2014-05-11T20:04:37Z",
17 "createdBy": {
18 "sys": {
19 "type": "Link",
20 "linkType": "User",
21 "id": "3Z6OpTgoCqMTwQ331UvyF4"
22 }
23 },
24 "updatedBy": {
25 "sys": {
26 "type": "Link",
27 "linkType": "User",
28 "id": "6i5or8iabD6qwHCK7JgGLn"
29 }
30 },
31 "space": {
32 "sys": {
33 "type": "Link",
34 "linkType": "Space",
35 "id": "jn066pnp3hgr"
36 }
37 },
38 "user": {
39 "sys": {
40 "type": "Link",
41 "linkType": "User",
42 "id": "7uqvFPPLzgtVaezGvjA9U6"
43 }
44 },
45 },
46 "roles": [
47 {
48 "sys": {
49 "type": "Link",
50 "linkType": "Role",
51 "id": "1ElgCn1mi1UHSBLTP2v4TD"
52 }
53 }
54 ]
55 }
56 ]
57}

Get all space memberships in an organization

Get all space memberships in an organization

This endpoint returns a paginated list of all space memberships across all spaces in the organization.

Only organization admins and owners can access this endpoint.

Query Parameters

NameDetailsDescription
skip, limit-Specify requested page of result set. See Pagination for more details.
orderSupported values: sys.createdAt, sys.user.firstName, sys.user.lastName, sys.user.emailSpecify sort order of result set. See Sorting Results for more details.
includeSupported values: roles, sys.user, sys.createdBy, sys.updatedBy, sys.spaceSpecify linked resources to include in response. See Including Related Resources for more details.
queryFields searched: sys.user.id, sys.user.firstName, sys.user.lastName, sys.user.emailSpecify a string to search for matching resources against. See Searching Multiple Attributes for more details.
FiltersSee section belowSpecify a value to filter against for the provided attribute. See Filtering Results for more information, and below for details about supported attributes for this endpoint.

Filter Parameters

See Filtering Results for details about how to use attributes and operators to construct query filters.

AttributeSupported OperatorsSupported Values
admineq, neBoolean
roles.sys.ideq, inString (id)
roles.nameeq, ne, nin, matchString
sys.user.sys.ideq, ne, in, ninString (id)
sys.space.sys.ideq, ne, in, ninString (id)
sys.space.nameeq, ne, in, ninString
sys.organizationMembership.sys.ideq, ne, in, ninString (id)
sys.createdAtlt, lte, gt, gteDatetime string
sys.updatedAtlt, lte, gt, gteDatetime string

Response

1{
2 "total": 1,
3 "limit": 25,
4 "skip": 0,
5 "sys": {
6 "type": "Array"
7 },
8 "items": [
9 {
10 "admin": false,
11 "sys": {
12 "type": "SpaceMembership",
13 "id": "jn066pnp3hgr-7uqvFPPLzgtVaezGvjA9U6",
14 "version": 0,
15 "createdAt": "2013-04-11T20:04:37Z",
16 "updatedAt": "2014-05-11T20:04:37Z",
17 "createdBy": {
18 "sys": {
19 "type": "Link",
20 "linkType": "User",
21 "id": "3Z6OpTgoCqMTwQ331UvyF4"
22 }
23 },
24 "updatedBy": {
25 "sys": {
26 "type": "Link",
27 "linkType": "User",
28 "id": "6i5or8iabD6qwHCK7JgGLn"
29 }
30 },
31 "space": {
32 "sys": {
33 "type": "Link",
34 "linkType": "Space",
35 "id": "jn066pnp3hgr"
36 }
37 },
38 "user": {
39 "sys": {
40 "type": "Link",
41 "linkType": "User",
42 "id": "7uqvFPPLzgtVaezGvjA9U6"
43 }
44 }
45 },
46 "roles": [
47 {
48 "sys": {
49 "type": "Link",
50 "linkType": "Role",
51 "id": "1ElgCn1mi1UHSBLTP2v4TD"
52 }
53 }
54 ]
55 }
56 ]
57}

Get a single space membership

Get a single space membership (space-scoped)

Get a single space membership (organization-scoped)

These endpoints return details about an existing space membership.

The first endpoint (scoped to a space) is accessible to all space members; the second (scoped to an organization) is accessible only to organization admin and owners.

Response

1{
2 "admin": false,
3 "sys": {
4 "type": "SpaceMembership",
5 "id": "jn066pnp3hgr-7uqvFPPLzgtVaezGvjA9U6",
6 "version": 0,
7 "createdAt": "2013-04-11T20:04:37Z",
8 "updatedAt": "2014-05-11T20:04:37Z",
9 "space": {
10 "sys": {
11 "type": "Link",
12 "linkType": "Space",
13 "id": "jn066pnp3hgr"
14 }
15 },
16 "createdBy": {
17 "sys": {
18 "type": "Link",
19 "linkType": "User",
20 "id": "34BcPDYW0r6kwCJV2lYevQ"
21 }
22 },
23 "updatedBy": {
24 "sys": {
25 "type": "Link",
26 "linkType": "User",
27 "id": "34BcPDYW0r6kwCJV2lYevQ"
28 }
29 },
30 "user": {
31 "sys": {
32 "type": "Link",
33 "linkType": "User",
34 "id": "7uqvFPPLzgtVaezGvjA9U6"
35 }
36 }
37 },
38 "roles": [
39 {
40 "sys": {
41 "type": "Link",
42 "linkType": "Role",
43 "id": "1ElgCn1mi1UHSBLTP2v4TD"
44 }
45 }
46 ]
47}

Create a space membership

Create a space membership

Use this endpoint to create a space membership. A user can either be designated as an admin or assigned to one or more roles. The user must already exist in the organization.

Only organization admins, owners, and space admins can access this endpoint.

Note: For legacy reasons, the user you are creating a space membership for needs to be identified by their email address. This email address must match the email address of the user associated with an existing organization membership in your organization.

Request Body

ParameterTypeUsage
adminbooleanrequired
rolesarray(Role)required; must contain at least one role if admin is false (see also Roles)
emailstringrequired

Response

1{
2 "admin": false,
3 "sys": {
4 "type": "SpaceMembership",
5 "id": "jn066pnp3hgr-7uqvFPPLzgtVaezGvjA9U6",
6 "version": 0,
7 "createdAt": "2013-04-11T20:04:37Z",
8 "updatedAt": "2013-04-11T20:04:37Z",
9 "space": {
10 "sys": {
11 "type": "Link",
12 "linkType": "Space",
13 "id": "jn066pnp3hgr"
14 }
15 },
16 "createdBy": {
17 "sys": {
18 "type": "Link",
19 "linkType": "User",
20 "id": "34BcPDYW0r6kwCJV2lYevQ"
21 }
22 },
23 "updatedBy": null,
24 "user": {
25 "sys": {
26 "type": "Link",
27 "linkType": "User",
28 "id": "7uqvFPPLzgtVaezGvjA9U6"
29 }
30 }
31 },
32 "roles": [
33 {
34 "sys": {
35 "type": "Link",
36 "linkType": "Role",
37 "id": "1ElgCn1mi1UHSBLTP2v4TD"
38 }
39 }
40 ]
41}

Update a space membership

Update a space membership

This endpoint updates a space membership. Use this to change the roles for a user or make them an admin within the space.

Only organization admins, owners, and space admins can access this endpoint.

Request Body

ParameterTypeUsage
adminbooleanrequired
rolesarray(Role)required; must contain at least one role if admin is false (see also Roles)
emailstringrequired

Response

1{
2 "admin": false,
3 "sys": {
4 "type": "SpaceMembership",
5 "id": "jn066pnp3hgr-7uqvFPPLzgtVaezGvjA9U6",
6 "version": 0,
7 "createdAt": "2013-04-11T20:04:37Z",
8 "updatedAt": "2014-05-11T20:04:37Z",
9 "space": {
10 "sys": {
11 "type": "Link",
12 "linkType": "Space",
13 "id": "jn066pnp3hgr"
14 }
15 },
16 "createdBy": {
17 "sys": {
18 "type": "Link",
19 "linkType": "User",
20 "id": "34BcPDYW0r6kwCJV2lYevQ"
21 }
22 },
23 "updatedBy": {
24 "sys": {
25 "type": "Link",
26 "linkType": "User",
27 "id": "34BcPDYW0r6kwCJV2lYevQ"
28 }
29 },
30 "user": {
31 "sys": {
32 "type": "Link",
33 "linkType": "User",
34 "id": "7uqvFPPLzgtVaezGvjA9U6"
35 }
36 }
37 },
38 "roles": [
39 {
40 "sys": {
41 "type": "Link",
42 "linkType": "Role",
43 "id": "1ElgCn1mi1UHSBLTP2v4TD"
44 }
45 }
46 ]
47}

Delete a space membership

Delete a space membership

This endpoint deletes a space membership.

Only organization admins, owners, and space admins can access this endpoint. The user associated with the space membership also has access to this endpoint (so that they have permission to remove themselves from an organization).

Response

Status: 204 No Content