---
title: "Grant access"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.sureshake.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Sureshake API › entities

`POST /v2/entities/{entityId}/collections/{id}/access`

## Path parameters

- `entityId` (`collection-grant-access.path.entityId`; string, required)
  - format `uuid`
- `id` (`collection-grant-access.path.id`; string, required)
  - format `uuid`

## Request body

- `userId` (`collection-grant-access.userId`; string, optional)
  - minLength 1
- `grantedToUserId` (`collection-grant-access.grantedToUserId`; string, optional)
  - minLength 1
- `accessLevel` (`collection-grant-access.accessLevel`; string, optional)
  - one of `"read"`, `"write"`, `"admin"`
- `permission` (`collection-grant-access.permission`; string, optional)
  - one of `"read"`, `"write"`, `"admin"`
- `role` (`collection-grant-access.role`; string, optional)
  - one of `"read"`, `"write"`, `"admin"`

## Example request

```json
{
  "userId": "string",
  "grantedToUserId": "string",
  "accessLevel": "read",
  "permission": "read",
  "role": "read"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sureshake.com/v2/entities/<entityId>/collections/<id>/access' \
  --header 'Content-Type: application/json' \
  --data '
{
  "userId": "string",
  "grantedToUserId": "string",
  "accessLevel": "read",
  "permission": "read",
  "role": "read"
}
'
```

### TypeScript

```typescript
const url = 'https://api.sureshake.com/v2/entities/<entityId>/collections/<id>/access';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    userId: 'string',
    grantedToUserId: 'string',
    accessLevel: 'read',
    permission: 'read',
    role: 'read'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sureshake.com/v2/entities/<entityId>/collections/<id>/access"

payload = {
    "userId": "string",
    "grantedToUserId": "string",
    "accessLevel": "read",
    "permission": "read",
    "role": "read"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Default Response

#### Example

```json
{
  "data": {
    "success": true,
    "access": {
      "id": "string",
      "userId": "string",
      "grantedToUserId": "string",
      "grantedToName": "string",
      "grantedToEmail": "string",
      "accessLevel": "read",
      "permission": "read",
      "grantedAt": "string",
      "createdAt": "string",
      "updatedAt": "string"
    }
  }
}
```

- `data` (`collection-grant-access.response.200.data`; object, required)
  - `success` (`collection-grant-access.response.200.data.success`; boolean, required)
  - `access` (`collection-grant-access.response.200.data.access`; object, optional)
    - `id` (`collection-grant-access.response.200.data.access.id`; string, required)
    - `userId` (`collection-grant-access.response.200.data.access.userId`; string, required)
    - `grantedToUserId` (`collection-grant-access.response.200.data.access.grantedToUserId`; string, required)
    - `accessLevel` (`collection-grant-access.response.200.data.access.accessLevel`; string, required)
      - one of `"read"`, `"write"`, `"admin"`
    - `permission` (`collection-grant-access.response.200.data.access.permission`; string, required)
      - one of `"read"`, `"write"`, `"admin"`
    - `grantedAt` (`collection-grant-access.response.200.data.access.grantedAt`; string, required)
    - `createdAt` (`collection-grant-access.response.200.data.access.createdAt`; string, required)
    - `updatedAt` (`collection-grant-access.response.200.data.access.updatedAt`; string, required)
    - `grantedToName` (`collection-grant-access.response.200.data.access.grantedToName`; string, optional, nullable)
    - `grantedToEmail` (`collection-grant-access.response.200.data.access.grantedToEmail`; string, optional, nullable)

### 400

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`collection-grant-access.response.400.error`; object, required)
  - `code` (`collection-grant-access.response.400.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-grant-access.response.400.error.message`; string, required) — Human-readable error message
  - `details` (`collection-grant-access.response.400.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-grant-access.response.400.error.traceId`; string, optional) — Unique ID for log correlation

### 401

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`collection-grant-access.response.401.error`; object, required)
  - `code` (`collection-grant-access.response.401.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-grant-access.response.401.error.message`; string, required) — Human-readable error message
  - `details` (`collection-grant-access.response.401.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-grant-access.response.401.error.traceId`; string, optional) — Unique ID for log correlation

### 403

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`collection-grant-access.response.403.error`; object, required)
  - `code` (`collection-grant-access.response.403.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-grant-access.response.403.error.message`; string, required) — Human-readable error message
  - `details` (`collection-grant-access.response.403.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-grant-access.response.403.error.traceId`; string, optional) — Unique ID for log correlation

### 404

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`collection-grant-access.response.404.error`; object, required)
  - `code` (`collection-grant-access.response.404.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-grant-access.response.404.error.message`; string, required) — Human-readable error message
  - `details` (`collection-grant-access.response.404.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-grant-access.response.404.error.traceId`; string, optional) — Unique ID for log correlation

### 409

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`collection-grant-access.response.409.error`; object, required)
  - `code` (`collection-grant-access.response.409.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-grant-access.response.409.error.message`; string, required) — Human-readable error message
  - `details` (`collection-grant-access.response.409.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-grant-access.response.409.error.traceId`; string, optional) — Unique ID for log correlation

### 500

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`collection-grant-access.response.500.error`; object, required)
  - `code` (`collection-grant-access.response.500.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-grant-access.response.500.error.message`; string, required) — Human-readable error message
  - `details` (`collection-grant-access.response.500.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-grant-access.response.500.error.traceId`; string, optional) — Unique ID for log correlation


Source: https://docs.sureshake.com/reference/collection-grant-access/index.md
