# Invite

## Module endpoints

* [`GET /invites`](#get-invites)
* [`GET /invites/:code`](#get-invites-code)
* [`GET /invites/:code/validate`](#get-invites-code-validate)
* [`POST /invites`](#post-invites)
* [`POST /invites/:code/cancel`](#post-invites-code-cancel)
* [`POST /invites/send`](#post-invites-send)

### `GET /invites`

> `GET` <https://api.slyk.i&#x6F;**/invites>\*\*

Returns a paginated list of `invites`.

{% tabs %}
{% tab title="Available Filters" %}

| Name              |      Type      | Example                                                                                              |
| ----------------- | :------------: | ---------------------------------------------------------------------------------------------------- |
| **code**          | `=` `in` `nin` | `filter[code]=I12345678`                                                                             |
| **expiredAt**     |   `gte` `lte`  | `filter[expiredAt]=gte:2020-03-05`                                                                   |
| **invitedEmail**  | `=` `in` `nin` | `filter[invitedEmail]=foo@bar.com`                                                                   |
| **invitedUserId** |       `=`      | `filter[invitedUserId]=in:fc78d28f-a8dd-49de-a22f-722fe3bd26c7,7938e446-1c77-4513-8cb0-8b1f2e9f47b9` |
| **inviterUserId** | `=` `in` `nin` | `filter[inviterUserId]=7938e446-1c77-4513-8cb0-8b1f2e9f47b9`                                         |
| **status**        | `=` `in` `nin` | `filter[status]=nin:canceled`                                                                        |
| **type**          |       `=`      | `filter[type]=invite`                                                                                |
| {% endtab %}      |                |                                                                                                      |

{% tab title="Available Sorts" %}

| Name          | Example                                                            |
| ------------- | ------------------------------------------------------------------ |
| **createdAt** | <p><code>sort=createdAt</code><br><code>sort=-createdAt</code></p> |
| **expiredAt** | <p><code>sort=expiredAt</code><br><code>sort=-expiredAt</code></p> |
| **updatedAt** | <p><code>sort=updatedAt</code><br><code>sort=-updatedAt</code></p> |
| {% endtab %}  |                                                                    |

{% tab title="Paginate Options" %}

| Name         | Description                                             | Example          |
| ------------ | ------------------------------------------------------- | ---------------- |
| **size**     | Defines the number of results per page. Default = 30.   | `page[size]=2`   |
| **number**   | Defines the number of the page to retrieve. Default = 1 | `page[number]=2` |
| {% endtab %} |                                                         |                  |

{% tab title="Response" %}

```javascript
{
  "data": [
    {
      "code": "I12345678",
      "createdAt": "2019-07-17T11:39:26.732Z",
      "expiredAt": "2019-08-16T11:39:26.732Z",
      "invitedEmail": "foo@biz.com",
      "invitedUserId": null,
      "inviterUserId": null,
      "metadata": {},
      "status": "canceled",
      "type": "invite",
      "updatedAt": "2019-07-17T11:39:26.732Z",
      "url": "https://example.slyk.io/i/I12345678"
    },
    {
      "code": "I87654321",
      "createdAt": "2019-07-17T11:39:26.732Z",
      "expiredAt": "2019-08-16T11:39:26.732Z",
      "invitedEmail": "foo@bar.com",
      "invitedUserId": null,
      "inviterUserId": null,
      "metadata": {},
      "status": "pending",
      "type": "invite",
      "updatedAt": "2019-07-17T11:39:26.732Z",
      "url": "https://example.slyk.io/i/I87654321"
    }
  ],
  "total": 2
}
```

{% endtab %}
{% endtabs %}

### `GET /invites/:code`

> `GET` <https://api.slyk.i&#x6F;**/invites/:id>\*\*

Gets the invite details of the given `code`.

{% tabs %}
{% tab title="Response" %}

```javascript
{
  "data": {
    "code": "I87654321",
    "createdAt": "2019-07-17T11:39:26.732Z",
    "expiredAt": "2019-08-16T11:39:26.732Z",
    "invitedEmail": "foo@bar.com",
    "invitedUserId": null,
    "inviterUserId": null,
    "metadata": {},
    "status": "accepted",
    "type": "invite",
    "updatedAt": "2019-07-17T11:39:26.732Z",
    "url": "https://example.slyk.io/i/I87654321"
  }
}
```

{% endtab %}
{% endtabs %}

### `GET /invites/:code/validate`

> `GET` <https://api.slyk.i&#x6F;**/invites/:code/validate>\*\*

Validates the `invite` with the given `code`.

{% tabs %}
{% tab title="Response" %}

```javascript
{
  "data": {
    "referrerName": "Waldo Fred"
  }
}
```

{% endtab %}
{% endtabs %}

### `POST /invites`

> `POST` <https://api.slyk.i&#x6F;**/invites>\*\*

Creates a new `invite`.

{% tabs %}
{% tab title="Request Parameters" %}

| Field             |   Type   | Required | Description                                       |
| ----------------- | :------: | :------: | ------------------------------------------------- |
| **email**         | `string` |  `false` | Email intended for the invitation.                |
| **inviterUserId** | `string` |  `false` | User who generated the invitation. Format `uuid`. |
| {% endtab %}      |          |          |                                                   |

{% tab title="Request" %}

```javascript
{
  "email": "foo@biz.com"
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "code": "I12345678",
    "createdAt": "2019-07-17T11:39:26.732Z",
    "expiredAt": "2019-08-16T11:39:26.732Z",
    "invitedEmail": "foo@biz.com",
    "invitedUserId": null,
    "inviterUserId": null,
    "metadata": {},
    "status": "pending",
    "type": "invite",
    "updatedAt": "2019-07-17T11:39:26.732Z",
    "url": "https://early.slyk.io/i/I12345678"
  }
}
```

{% endtab %}
{% endtabs %}

### `POST /invites/:code/cancel`

> `POST` <https://api.slyk.i&#x6F;**/invites/:code/cancel>\*\*

Cancels the invite of the given `code`.

{% tabs %}
{% tab title="Response" %}

```javascript
{
  "data": {
    "code": "I12345678",
    "createdAt": "2019-07-17T11:39:26.732Z",
    "expiredAt": "2019-08-16T11:39:26.732Z",
    "invitedEmail": "foo@biz.com",
    "invitedUserId": null,
    "inviterUserId": null,
    "metadata": {},
    "status": "canceled",
    "type": "invite",
    "updatedAt": "2019-07-17T11:39:26.732Z",
    "url": "https://early.slyk.io/i/I12345678"
  }
}
```

{% endtab %}
{% endtabs %}

### `POST /invites/send`

> `POST` <http://api.slyk.i&#x6F;**/invites/send>\*\*

Sends the `invite` directly to the emails to who is intended.&#x20;

{% tabs %}
{% tab title="Request Parameters" %}

| Field             |       Type       | Required | Description                                                       |
| ----------------- | :--------------: | :------: | ----------------------------------------------------------------- |
| **email**         | `string` `array` |  `true`  | A single or an array of emails to who is intended for invitation. |
| **inviterUserId** |     `string`     |  `false` | User who generated the invitation. Format `uuid`.                 |
| {% endtab %}      |                  |          |                                                                   |

{% tab title="Request" %}

```javascript
{
  "email": ["corge@garply.com","foo@biz.com"],
  "inviterUserId": "174c3e0d-226f-443a-a010-12b2140de03c"
}
```

{% endtab %}

{% tab title="Response" %}

> `204` No Content
> {% endtab %}
> {% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.slyk.io/slyk/reference/endpoints/invite.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
