> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.modex.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.modex.com/_mcp/server.

# Invite users

POST https://api.modex.com/v1/clients/{client_id}/invitations
Content-Type: application/json

Invites people to join a client you own. Each address receives an email with a link to accept.

**Body:**

| Field    | Type             | Required | Description                       |
| -------- | ---------------- | -------- | --------------------------------- |
| `emails` | array of strings | yes      | One or more valid email addresses |

* Addresses repeated in one request (case-insensitive) are invited once.
* Any earlier invitation on this client for the same address is revoked and replaced.
* Invitations don't check your seat limit. Compare `total_users` from **List Clients** to `max_users` before inviting.

Returns **201** with `data[]` of `{id, email, created_at}`. Invalid input returns 422 with per-field `details` (for example `emails.0`).

Reference: https://docs.modex.com/api-reference/account/client-seats/create-client-invitations

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `client_id` (string, required)

### Body (application/json)

This endpoint expects an object.

- `emails` (list of string, optional)

## Response

### 201

Created

- `data` (list of V1ClientsClientIdInvitationsPostResponsesContentApplicationJsonSchemaDataItems, optional) — The records on this page.

## Errors

### 422 Unprocessable Entity Error

Unprocessable Content

- `error` (ApiErrorError, required)

## Types

### V1ClientsClientIdInvitationsPostResponsesContentApplicationJsonSchemaDataItems

- `id` (string, optional) — Invitation ID
- `email` (string, optional) — Invited email address
- `created_at` (datetime, optional) — When the invitation was sent

### ApiErrorError

- `type` (string, required) — Error category: invalid_request, authentication_error, permission_error, not_found, rate_limit_error, or api_error.
- `code` (string, required) — Specific error code. Same as `type`, except `validation_error` for request-body validation failures.
- `message` (string, required) — Human-readable explanation.
- `details` (map from string to list of string, optional) — Validation errors only: each invalid field mapped to its messages.

## Examples

### Invited

**Request**

```json
{
  "emails": [
    "taylor.brooks@example.com",
    "jamie.ortiz@example.com"
  ]
}
```

**Response**

```json
{
  "data": [
    {
      "id": "9e8d7c6b-5a4f-4e3d-8c2b-1a0f9e8d7c6b",
      "email": "taylor.brooks@example.com",
      "created_at": "2026-10-27T16:20:00+00:00"
    },
    {
      "id": "0f1e2d3c-4b5a-4968-8776-5a4b3c2d1e0f",
      "email": "jamie.ortiz@example.com",
      "created_at": "2026-10-27T16:20:00+00:00"
    }
  ]
}
```

**SDK Code**

```python Invited
import requests

url = "https://api.modex.com/v1/clients/client_id/invitations"

payload = { "emails": ["taylor.brooks@example.com", "jamie.ortiz@example.com"] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Invited
const url = 'https://api.modex.com/v1/clients/client_id/invitations';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"emails":["taylor.brooks@example.com","jamie.ortiz@example.com"]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Invited
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.modex.com/v1/clients/client_id/invitations"

	payload := strings.NewReader("{\n  \"emails\": [\n    \"taylor.brooks@example.com\",\n    \"jamie.ortiz@example.com\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Invited
require 'uri'
require 'net/http'

url = URI("https://api.modex.com/v1/clients/client_id/invitations")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"emails\": [\n    \"taylor.brooks@example.com\",\n    \"jamie.ortiz@example.com\"\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Invited
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.modex.com/v1/clients/client_id/invitations")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"emails\": [\n    \"taylor.brooks@example.com\",\n    \"jamie.ortiz@example.com\"\n  ]\n}")
  .asString();
```

```php Invited
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.modex.com/v1/clients/client_id/invitations', [
  'body' => '{
  "emails": [
    "taylor.brooks@example.com",
    "jamie.ortiz@example.com"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Invited
using RestSharp;

var client = new RestClient("https://api.modex.com/v1/clients/client_id/invitations");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"emails\": [\n    \"taylor.brooks@example.com\",\n    \"jamie.ortiz@example.com\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Invited
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["emails": ["taylor.brooks@example.com", "jamie.ortiz@example.com"]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.modex.com/v1/clients/client_id/invitations")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Invalid email

**Request**

```json
{
  "emails": [
    "not-an-email"
  ]
}
```

**Response**

```json
{
  "data": [
    {
      "id": "9e8d7c6b-5a4f-4e3d-8c2b-1a0f9e8d7c6b",
      "email": "taylor.brooks@example.com",
      "created_at": "2026-10-27T16:20:00+00:00"
    },
    {
      "id": "0f1e2d3c-4b5a-4968-8776-5a4b3c2d1e0f",
      "email": "jamie.ortiz@example.com",
      "created_at": "2026-10-27T16:20:00+00:00"
    }
  ]
}
```

**SDK Code**

```python Invalid email
import requests

url = "https://api.modex.com/v1/clients/client_id/invitations"

payload = { "emails": ["not-an-email"] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Invalid email
const url = 'https://api.modex.com/v1/clients/client_id/invitations';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"emails":["not-an-email"]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Invalid email
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.modex.com/v1/clients/client_id/invitations"

	payload := strings.NewReader("{\n  \"emails\": [\n    \"not-an-email\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Invalid email
require 'uri'
require 'net/http'

url = URI("https://api.modex.com/v1/clients/client_id/invitations")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"emails\": [\n    \"not-an-email\"\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Invalid email
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.modex.com/v1/clients/client_id/invitations")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"emails\": [\n    \"not-an-email\"\n  ]\n}")
  .asString();
```

```php Invalid email
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.modex.com/v1/clients/client_id/invitations', [
  'body' => '{
  "emails": [
    "not-an-email"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Invalid email
using RestSharp;

var client = new RestClient("https://api.modex.com/v1/clients/client_id/invitations");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"emails\": [\n    \"not-an-email\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Invalid email
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["emails": ["not-an-email"]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.modex.com/v1/clients/client_id/invitations")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```