---
title: "Create invite"
---

> 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}/invites`

## Path parameters

- `entityId` (`collection-create-invite.path.entityId`; string, required)
  - format `uuid`
- `id` (`collection-create-invite.path.id`; string, required)
  - format `uuid`

## Request body

- `permission` (`collection-create-invite.permission`; string, optional)
  - one of `"viewer"`, `"download"`
- `expiresAt` (`collection-create-invite.expiresAt`; string, optional, nullable)
  - format `date-time`
- `maxUses` (`collection-create-invite.maxUses`; integer, optional, nullable)
  - min 1; max 100000

## Example request

```json
{
  "permission": "viewer",
  "expiresAt": "2019-08-24T14:15:22Z",
  "maxUses": 1
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sureshake.com/v2/entities/<entityId>/collections/<id>/invites' \
  --header 'Content-Type: application/json' \
  --data '
{
  "permission": "viewer",
  "expiresAt": "2019-08-24T14:15:22Z",
  "maxUses": 1
}
'
```

### TypeScript

```typescript
const url = 'https://api.sureshake.com/v2/entities/<entityId>/collections/<id>/invites';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({permission: 'viewer', expiresAt: '2019-08-24T14:15:22Z', maxUses: 1})
};

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>/invites"

payload = {
    "permission": "viewer",
    "expiresAt": "2019-08-24T14:15:22Z",
    "maxUses": 1
}
headers = {"Content-Type": "application/json"}

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

print(response.text)
```

## Responses

### 200

Default Response

#### Example

```json
{
  "data": {
    "invite": {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "code": "string",
      "collectionId": "0ffe69e2-b7af-4b1e-835c-867376165f50",
      "inviterUserId": "string",
      "permission": "viewer",
      "status": "active",
      "expiresAt": "string",
      "maxUses": 0,
      "uses": 0,
      "lastUsedAt": "string",
      "createdAt": "string",
      "updatedAt": "string",
      "inviteUrl": "string",
      "qrPayload": "string",
      "valid": true,
      "disabledReason": "revoked"
    },
    "sharePermission": "viewer"
  },
  "meta": {
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
```

- `data` (`collection-create-invite.response.200.data`; object, required)
  - `invite` (`collection-create-invite.response.200.data.invite`; object, required)
    - `id` (`collection-create-invite.response.200.data.invite.id`; string, required)
      - format `uuid`
    - `code` (`collection-create-invite.response.200.data.invite.code`; string, required)
    - `collectionId` (`collection-create-invite.response.200.data.invite.collectionId`; string, required)
      - format `uuid`
    - `inviterUserId` (`collection-create-invite.response.200.data.invite.inviterUserId`; string, required)
    - `permission` (`collection-create-invite.response.200.data.invite.permission`; string, required)
      - one of `"viewer"`, `"download"`
    - `status` (`collection-create-invite.response.200.data.invite.status`; string, required)
      - one of `"active"`, `"revoked"`, `"expired"`
    - `expiresAt` (`collection-create-invite.response.200.data.invite.expiresAt`; string, required, nullable)
    - `maxUses` (`collection-create-invite.response.200.data.invite.maxUses`; number, required, nullable)
    - `uses` (`collection-create-invite.response.200.data.invite.uses`; number, required)
    - `createdAt` (`collection-create-invite.response.200.data.invite.createdAt`; string, required)
    - `updatedAt` (`collection-create-invite.response.200.data.invite.updatedAt`; string, required)
    - `lastUsedAt` (`collection-create-invite.response.200.data.invite.lastUsedAt`; string, optional, nullable)
    - `inviteUrl` (`collection-create-invite.response.200.data.invite.inviteUrl`; string, optional)
    - `qrPayload` (`collection-create-invite.response.200.data.invite.qrPayload`; string, optional)
    - `valid` (`collection-create-invite.response.200.data.invite.valid`; boolean, optional)
    - `disabledReason` (`collection-create-invite.response.200.data.invite.disabledReason`; string, optional, nullable)
      - one of `"revoked"`, `"expired"`, `"max_uses_reached"`
  - `sharePermission` (`collection-create-invite.response.200.data.sharePermission`; string, required)
    - one of `"viewer"`, `"download"`
- `meta` (`collection-create-invite.response.200.meta`; object, optional)
  - `timestamp` (`collection-create-invite.response.200.meta.timestamp`; string, required)
    - format `date-time`

### 400

Default Response

#### Example

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

- `error` (`collection-create-invite.response.400.error`; object, required)
  - `code` (`collection-create-invite.response.400.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-create-invite.response.400.error.message`; string, required) — Human-readable error message
  - `details` (`collection-create-invite.response.400.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-create-invite.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-create-invite.response.401.error`; object, required)
  - `code` (`collection-create-invite.response.401.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-create-invite.response.401.error.message`; string, required) — Human-readable error message
  - `details` (`collection-create-invite.response.401.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-create-invite.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-create-invite.response.403.error`; object, required)
  - `code` (`collection-create-invite.response.403.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-create-invite.response.403.error.message`; string, required) — Human-readable error message
  - `details` (`collection-create-invite.response.403.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-create-invite.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-create-invite.response.404.error`; object, required)
  - `code` (`collection-create-invite.response.404.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-create-invite.response.404.error.message`; string, required) — Human-readable error message
  - `details` (`collection-create-invite.response.404.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-create-invite.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-create-invite.response.409.error`; object, required)
  - `code` (`collection-create-invite.response.409.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-create-invite.response.409.error.message`; string, required) — Human-readable error message
  - `details` (`collection-create-invite.response.409.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-create-invite.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-create-invite.response.500.error`; object, required)
  - `code` (`collection-create-invite.response.500.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-create-invite.response.500.error.message`; string, required) — Human-readable error message
  - `details` (`collection-create-invite.response.500.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-create-invite.response.500.error.traceId`; string, optional) — Unique ID for log correlation


Source: https://docs.sureshake.com/reference/collection-create-invite/index.md
