# Create an invite

> Management API · User Management

```http
POST https://app.mk.io/api/v1/organization/invites
```

This endpoint allows you to create a new invitation which will grant a user access to this organization's resources within MK.IO.

You can include a comment which will be visible against this user's record when they accept the invitation, e.g. "Contractor for project Delphi".

RBAC Capability Required: `core.invite.create`

## Authentication

- `Authorization` header — Bearer authentication of the form `Bearer <token>`.

## Request body

Content type: `application/json`

- `spec` · object · **Required** — Specification
  - `comment` · string · **Required** — Comment to explain why the user has been invited to collaborate with your organization
  - `email` · string · **Required** — Email of the user to be invited
  - `teams` · list of strings · Optional — List of team names to add this user to when they accept.
    - Array items (string):

## Example request

```bash
curl -X POST "https://app.mk.io/api/v1/organization/invites" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
  "spec": {
    "comment": "string",
    "email": "string",
    "teams": [
      "string"
    ]
  }
}'
```

## Responses

### 201 — OK

- `kind` · string · Optional — The kind of record.
- `metadata` · object · Optional — Metadata
  - `created` · string · Optional · _format: date-time_ — The time when the resource was created
  - `id` · string · **Required** · _format: uuid_ — The ID of the resource
- `spec` · object · **Required** — Specification
  - `comment` · string · **Required** — Comment to explain why the user has been invited to collaborate with your organization
  - `email` · string · **Required** — Email of the user to be invited
  - `invitedByEmail` · string · **Required** — Contact email of user who made the invite
  - `invitedByName` · string · **Required** — Name of user who made the invite
  - `organizationName` · string · **Required** — Name of the organization the invite refers to
  - `teams` · list of strings · Optional — List of team names to add this user to when they accept.
    - Array items (string):

Example:

```json
{
  "kind": "string",
  "metadata": {
    "created": "2024-01-01T00:00:00Z",
    "id": "00000000-0000-0000-0000-000000000000"
  },
  "spec": {
    "comment": "string",
    "email": "string",
    "invitedByEmail": "string",
    "invitedByName": "string",
    "organizationName": "string",
    "teams": [
      "string"
    ]
  }
}
```

### 400 — Bad Request

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 401 — Unauthorized

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 403 — Forbidden

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 404 — Not Found

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 409 — Conflict

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 429 — Too Many Requests

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 500 — Internal Server Error

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

---

Source spec: `management-api` · operationId: `[post]_/api/v1/organization/invites`
