export const metadata = {
  title: "People - OnlineOrNot API Documentation",
  description:
    "List and manage users in your organization, including pending invitations",
}

## List all users   {{ tag: 'GET', label: '/v1/users' }}
<Row>
<Col>

<a id="opIdlistUsers"></a>

*Retrieve a paginated list of all users in your organisation*

### Security: Bearer Auth
Provide your bearer token in the Authorization header when making requests to protected resources.

Example: `Authorization: Bearer 123`

<ParameterTree parameters={[{"schema":{"type":"string","default":"1","example":1,"description":"Page number of paginated results."},"required":false,"description":"Page number of paginated results.","name":"page","in":"query","exampleValues":{"object":1,"json":"'1'"},"originalType":"string","safeType":"string","shortDesc":"Page number of paginated results.","style":"form"},{"schema":{"type":"string","default":"20","example":20,"description":"Number of items per page."},"required":false,"description":"Number of items per page.","name":"per_page","in":"query","exampleValues":{"object":20,"json":"'20'"},"originalType":"string","safeType":"string","shortDesc":"Number of items per page.","style":"form"},{"schema":{"type":"string","example":"example","description":"Search term to filter results."},"required":false,"description":"Search term to filter results.","name":"search","in":"query","exampleValues":{"object":"example","json":"'example'"},"originalType":"string","safeType":"string","shortDesc":"Search term to filter results.","style":"form"}]} title="Query parameters" />

<h3 id="retrieve-a-paginated-list-of-all-users-in-your-organisation-responses">Responses</h3>

|Status|Meaning|Description|
|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Returns a list of users in the organisation|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthenticated|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal Server Error|

<ResponseSchemas schemas={[{"status":"200","properties":[{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"abc123","description":"The unique identifier of the user"},"first_name":{"type":["string","null"],"example":"Jane","description":"The user's first name"},"last_name":{"type":["string","null"],"example":"Doe","description":"The user's last name"},"email":{"type":["string","null"],"example":"jane@example.com","description":"The user's email address"},"image":{"type":["string","null"],"example":"https://example.com/avatar.jpg","description":"URL to the user's avatar image"},"role":{"type":"string","enum":["ADMIN","STANDARD"],"example":"STANDARD","description":"The role of the user in the organisation"}},"required":["id","first_name","last_name","email","image","role"]}},"in":"body","name":"result","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» result"},{"schema":{"type":"string","example":"abc123","description":"The unique identifier of the user"},"in":"body","name":"id","depth":2,"description":"The unique identifier of the user","type":"string","safeType":"string","required":true,"displayName":"»» id"},{"schema":{"type":["string","null"],"example":"Jane","description":"The user's first name"},"in":"body","name":"first_name","depth":2,"description":"The user's first name","type":["string","null"],"safeType":["string","null"],"required":true,"displayName":"»» first_name"},{"schema":{"type":["string","null"],"example":"Doe","description":"The user's last name"},"in":"body","name":"last_name","depth":2,"description":"The user's last name","type":["string","null"],"safeType":["string","null"],"required":true,"displayName":"»» last_name"},{"schema":{"type":["string","null"],"example":"jane@example.com","description":"The user's email address"},"in":"body","name":"email","depth":2,"description":"The user's email address","type":["string","null"],"safeType":["string","null"],"required":true,"displayName":"»» email"},{"schema":{"type":["string","null"],"example":"https://example.com/avatar.jpg","description":"URL to the user's avatar image"},"in":"body","name":"image","depth":2,"description":"URL to the user's avatar image","type":["string","null"],"safeType":["string","null"],"required":true,"displayName":"»» image"},{"schema":{"type":"string","enum":["ADMIN","STANDARD"],"example":"STANDARD","description":"The role of the user in the organisation"},"in":"body","name":"role","depth":2,"description":"The role of the user in the organisation","type":"string","safeType":"string","required":true,"displayName":"»» role"},{"schema":{"type":"object","properties":{"page":{"type":"number","default":1,"example":1,"description":"Page number of paginated results."},"per_page":{"type":"number","default":20,"example":20,"description":"Number of items per page."},"count":{"type":"number","example":1,"description":"Number of items on the current page."},"total_count":{"type":"number","example":1,"description":"Total number of items."}},"required":["count","total_count"]},"in":"body","name":"result_info","depth":1,"type":"object","safeType":"object","required":true,"displayName":"» result_info"},{"schema":{"type":"number","default":1,"example":1,"description":"Page number of paginated results."},"in":"body","name":"page","depth":2,"description":"Page number of paginated results.","type":"number","safeType":"number","required":false,"displayName":"»» page"},{"schema":{"type":"number","default":20,"example":20,"description":"Number of items per page."},"in":"body","name":"per_page","depth":2,"description":"Number of items per page.","type":"number","safeType":"number","required":false,"displayName":"»» per_page"},{"schema":{"type":"number","example":1,"description":"Number of items on the current page."},"in":"body","name":"count","depth":2,"description":"Number of items on the current page.","type":"number","safeType":"number","required":true,"displayName":"»» count"},{"schema":{"type":"number","example":1,"description":"Total number of items."},"in":"body","name":"total_count","depth":2,"description":"Total number of items.","type":"number","safeType":"number","required":true,"displayName":"»» total_count"},{"schema":{"type":"boolean","default":true,"example":true,"description":"Whether the API call was successful"},"in":"body","name":"success","depth":1,"description":"Whether the API call was successful","type":"boolean","safeType":"boolean","required":true,"displayName":"» success"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"errors","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» errors"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"messages","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» messages"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"}]}]} />

</Col>

<Col sticky>

<CodeGroup title="Request" tag="GET" label="/v1/users">
```bash {{ title: 'cURL' }}
curl --request GET \
  --url https://api.onlineornot.com/v1/users \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'
```

```javascript
fetch("https://api.onlineornot.com/v1/users", {
  "method": "GET",
  "headers": {
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
  }
})
.then(response => {
  console.log(response);
})
.catch(err => {
  console.error(err);
});
```

```java
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.onlineornot.com/v1/users")
  .get()
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "Bearer {access-token}")
  .build();

Response response = client.newCall(request).execute();
```

```php
<?php

$request = new HttpRequest();
$request->setUrl('https://api.onlineornot.com/v1/users');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders([
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
```

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

url = URI("https://api.onlineornot.com/v1/users")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["Accept"] = 'application/json'
request["Authorization"] = 'Bearer {access-token}'

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

```python
import requests

url = "https://api.onlineornot.com/v1/users"

headers = {
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
}

response = requests.request("GET", url, headers=headers)

print(response.text)
```

</CodeGroup>

```json {{ title: 'Response' }}
{
  "result": [
    {
      "id": "abc123",
      "first_name": "Jane",
      "last_name": "Doe",
      "email": "jane@example.com",
      "image": "https://example.com/avatar.jpg",
      "role": "STANDARD"
    }
  ],
  "result_info": {
    "page": 1,
    "per_page": 20,
    "count": 1,
    "total_count": 1
  },
  "success": true,
  "errors": [],
  "messages": []
}
```

</Col>
</Row>

---

## Remove a user from the organisation   {{ tag: 'DELETE', label: '/v1/users/{user_id}' }}
<Row>
<Col>

<a id="opIdremoveUser"></a>

*Remove a team member from your organisation*

### Security: Bearer Auth
Provide your bearer token in the Authorization header when making requests to protected resources.

Example: `Authorization: Bearer 123`

<ParameterTree parameters={[{"schema":{"type":"string","example":"abc123def","description":"The unique identifier of the user"},"required":true,"description":"The unique identifier of the user","name":"user_id","in":"path","exampleValues":{"object":"abc123def","json":"'abc123def'"},"originalType":"string","safeType":"string","shortDesc":"The unique identifier of the user","style":"simple"}]} title="Path parameters" />

<h3 id="remove-a-team-member-from-your-organisation-responses">Responses</h3>

|Status|Meaning|Description|
|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Returns the ID of the removed user|
|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad Request - Invalid user ID or cannot remove yourself|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthenticated|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Forbidden - Insufficient permissions|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|Not Found - User not in organisation|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal Server Error|

<ResponseSchemas schemas={[{"status":"200","properties":[{"schema":{"type":"object","properties":{"id":{"type":"string","example":"abc123","description":"ID of the removed user"}},"required":["id"]},"in":"body","name":"result","depth":1,"type":"object","safeType":"object","required":true,"displayName":"» result"},{"schema":{"type":"string","example":"abc123","description":"ID of the removed user"},"in":"body","name":"id","depth":2,"description":"ID of the removed user","type":"string","safeType":"string","required":true,"displayName":"»» id"},{"schema":{"type":"boolean","default":true,"example":true,"description":"Whether the API call was successful"},"in":"body","name":"success","depth":1,"description":"Whether the API call was successful","type":"boolean","safeType":"boolean","required":true,"displayName":"» success"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"errors","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» errors"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"messages","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» messages"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"}]}]} />

</Col>

<Col sticky>

<CodeGroup title="Request" tag="DELETE" label="/v1/users/{user_id}">
```bash {{ title: 'cURL' }}
curl --request DELETE \
  --url https://api.onlineornot.com/v1/users/abc123def \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'
```

```javascript
fetch("https://api.onlineornot.com/v1/users/abc123def", {
  "method": "DELETE",
  "headers": {
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
  }
})
.then(response => {
  console.log(response);
})
.catch(err => {
  console.error(err);
});
```

```java
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.onlineornot.com/v1/users/abc123def")
  .delete(null)
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "Bearer {access-token}")
  .build();

Response response = client.newCall(request).execute();
```

```php
<?php

$request = new HttpRequest();
$request->setUrl('https://api.onlineornot.com/v1/users/abc123def');
$request->setMethod(HTTP_METH_DELETE);

$request->setHeaders([
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
```

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

url = URI("https://api.onlineornot.com/v1/users/abc123def")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["Accept"] = 'application/json'
request["Authorization"] = 'Bearer {access-token}'

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

```python
import requests

url = "https://api.onlineornot.com/v1/users/abc123def"

headers = {
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
}

response = requests.request("DELETE", url, headers=headers)

print(response.text)
```

</CodeGroup>

```json {{ title: 'Response' }}
{
  "result": {
    "id": "abc123"
  },
  "success": true,
  "errors": [],
  "messages": []
}
```

</Col>
</Row>

---

## List all invitations   {{ tag: 'GET', label: '/v1/invitations' }}
<Row>
<Col>

<a id="opIdlistInvitations"></a>

*Retrieve a paginated list of all pending invitations in your organisation*

### Security: Bearer Auth
Provide your bearer token in the Authorization header when making requests to protected resources.

Example: `Authorization: Bearer 123`

<ParameterTree parameters={[{"schema":{"type":"string","default":"1","example":1,"description":"Page number of paginated results."},"required":false,"description":"Page number of paginated results.","name":"page","in":"query","exampleValues":{"object":1,"json":"'1'"},"originalType":"string","safeType":"string","shortDesc":"Page number of paginated results.","style":"form"},{"schema":{"type":"string","default":"20","example":20,"description":"Number of items per page."},"required":false,"description":"Number of items per page.","name":"per_page","in":"query","exampleValues":{"object":20,"json":"'20'"},"originalType":"string","safeType":"string","shortDesc":"Number of items per page.","style":"form"},{"schema":{"type":"string","example":"example","description":"Search term to filter results."},"required":false,"description":"Search term to filter results.","name":"search","in":"query","exampleValues":{"object":"example","json":"'example'"},"originalType":"string","safeType":"string","shortDesc":"Search term to filter results.","style":"form"}]} title="Query parameters" />

<h3 id="retrieve-a-paginated-list-of-all-pending-invitations-in-your-organisation-responses">Responses</h3>

|Status|Meaning|Description|
|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Returns a list of pending invitations|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthenticated|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal Server Error|

<ResponseSchemas schemas={[{"status":"200","properties":[{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"inv123","description":"The unique identifier of the invitation"},"email":{"type":"string","example":"newuser@example.com","description":"The email address the invitation was sent to"},"role":{"type":"string","enum":["ADMIN","STANDARD"],"example":"STANDARD","description":"The role of the user in the organisation"},"created_at":{"type":"string","example":"2024-01-15T10:30:00Z","description":"When the invitation was created"}},"required":["id","email","role","created_at"]}},"in":"body","name":"result","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» result"},{"schema":{"type":"string","example":"inv123","description":"The unique identifier of the invitation"},"in":"body","name":"id","depth":2,"description":"The unique identifier of the invitation","type":"string","safeType":"string","required":true,"displayName":"»» id"},{"schema":{"type":"string","example":"newuser@example.com","description":"The email address the invitation was sent to"},"in":"body","name":"email","depth":2,"description":"The email address the invitation was sent to","type":"string","safeType":"string","required":true,"displayName":"»» email"},{"schema":{"type":"string","enum":["ADMIN","STANDARD"],"example":"STANDARD","description":"The role of the user in the organisation"},"in":"body","name":"role","depth":2,"description":"The role of the user in the organisation","type":"string","safeType":"string","required":true,"displayName":"»» role"},{"schema":{"type":"string","example":"2024-01-15T10:30:00Z","description":"When the invitation was created"},"in":"body","name":"created_at","depth":2,"description":"When the invitation was created","type":"string","safeType":"string","required":true,"displayName":"»» created_at"},{"schema":{"type":"object","properties":{"page":{"type":"number","default":1,"example":1,"description":"Page number of paginated results."},"per_page":{"type":"number","default":20,"example":20,"description":"Number of items per page."},"count":{"type":"number","example":1,"description":"Number of items on the current page."},"total_count":{"type":"number","example":1,"description":"Total number of items."}},"required":["count","total_count"]},"in":"body","name":"result_info","depth":1,"type":"object","safeType":"object","required":true,"displayName":"» result_info"},{"schema":{"type":"number","default":1,"example":1,"description":"Page number of paginated results."},"in":"body","name":"page","depth":2,"description":"Page number of paginated results.","type":"number","safeType":"number","required":false,"displayName":"»» page"},{"schema":{"type":"number","default":20,"example":20,"description":"Number of items per page."},"in":"body","name":"per_page","depth":2,"description":"Number of items per page.","type":"number","safeType":"number","required":false,"displayName":"»» per_page"},{"schema":{"type":"number","example":1,"description":"Number of items on the current page."},"in":"body","name":"count","depth":2,"description":"Number of items on the current page.","type":"number","safeType":"number","required":true,"displayName":"»» count"},{"schema":{"type":"number","example":1,"description":"Total number of items."},"in":"body","name":"total_count","depth":2,"description":"Total number of items.","type":"number","safeType":"number","required":true,"displayName":"»» total_count"},{"schema":{"type":"boolean","default":true,"example":true,"description":"Whether the API call was successful"},"in":"body","name":"success","depth":1,"description":"Whether the API call was successful","type":"boolean","safeType":"boolean","required":true,"displayName":"» success"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"errors","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» errors"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"messages","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» messages"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"}]}]} />

</Col>

<Col sticky>

<CodeGroup title="Request" tag="GET" label="/v1/invitations">
```bash {{ title: 'cURL' }}
curl --request GET \
  --url https://api.onlineornot.com/v1/invitations \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}'
```

```javascript
fetch("https://api.onlineornot.com/v1/invitations", {
  "method": "GET",
  "headers": {
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
  }
})
.then(response => {
  console.log(response);
})
.catch(err => {
  console.error(err);
});
```

```java
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.onlineornot.com/v1/invitations")
  .get()
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "Bearer {access-token}")
  .build();

Response response = client.newCall(request).execute();
```

```php
<?php

$request = new HttpRequest();
$request->setUrl('https://api.onlineornot.com/v1/invitations');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders([
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
]);

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
```

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

url = URI("https://api.onlineornot.com/v1/invitations")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["Accept"] = 'application/json'
request["Authorization"] = 'Bearer {access-token}'

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

```python
import requests

url = "https://api.onlineornot.com/v1/invitations"

headers = {
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
}

response = requests.request("GET", url, headers=headers)

print(response.text)
```

</CodeGroup>

```json {{ title: 'Response' }}
{
  "result": [
    {
      "id": "inv123",
      "email": "newuser@example.com",
      "role": "STANDARD",
      "created_at": "2024-01-15T10:30:00Z"
    }
  ],
  "result_info": {
    "page": 1,
    "per_page": 20,
    "count": 1,
    "total_count": 1
  },
  "success": true,
  "errors": [],
  "messages": []
}
```

</Col>
</Row>

---

## Create an invitation   {{ tag: 'POST', label: '/v1/invitations' }}
<Row>
<Col>

<a id="opIdcreateInvitation"></a>

*Send an invitation email to add a new team member to your organisation*

### Security: Bearer Auth
Provide your bearer token in the Authorization header when making requests to protected resources.

Example: `Authorization: Bearer 123`

<ParameterTree parameters={[{"in":"body","schema":{"type":"object","properties":{"email":{"type":"string","format":"email","example":"newuser@example.com","description":"The email address to send the invitation to"},"role":{"type":"string","enum":["ADMIN","STANDARD"],"default":"STANDARD","example":"STANDARD","description":"The role to assign to the invited user"}},"required":["email"]},"name":"body","required":true,"exampleValues":{"object":{"email":"newuser@example.com","role":"STANDARD"},"json":"{\n  \"email\": \"newuser@example.com\",\n  \"role\": \"STANDARD\"\n}"},"originalType":"object","safeType":"object"},{"in":"body","schema":{"type":"string","format":"email","example":"newuser@example.com","description":"The email address to send the invitation to"},"name":"» email","required":true,"description":"The email address to send the invitation to","safeType":"string(email)","depth":1,"exampleValues":{"object":"newuser@example.com","json":"'newuser@example.com'"},"shortDesc":"The email address to send the invitation to"},{"in":"body","schema":{"type":"string","enum":["ADMIN","STANDARD"],"default":"STANDARD","example":"STANDARD","description":"The role to assign to the invited user"},"name":"» role","required":false,"description":"The role to assign to the invited user","safeType":"string","depth":1,"exampleValues":{"object":"STANDARD","json":"'STANDARD'"},"shortDesc":"The role to assign to the invited user"}]} title="Body parameters" />

<h3 id="send-an-invitation-email-to-add-a-new-team-member-to-your-organisation-responses">Responses</h3>

|Status|Meaning|Description|
|---|---|---|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|Returns the created invitation|
|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad Request - Invalid email or user already invited/exists|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthenticated|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Forbidden - Plan limit reached|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal Server Error|

<ResponseSchemas schemas={[{"status":"201","properties":[{"schema":{"type":"object","properties":{"id":{"type":"string","example":"inv123","description":"The unique identifier of the invitation"},"email":{"type":"string","example":"newuser@example.com","description":"The email address the invitation was sent to"},"role":{"type":"string","enum":["ADMIN","STANDARD"],"example":"STANDARD","description":"The role of the user in the organisation"},"created_at":{"type":"string","example":"2024-01-15T10:30:00Z","description":"When the invitation was created"}},"required":["id","email","role","created_at"]},"in":"body","name":"result","depth":1,"type":"object","safeType":"object","required":true,"displayName":"» result"},{"schema":{"type":"string","example":"inv123","description":"The unique identifier of the invitation"},"in":"body","name":"id","depth":2,"description":"The unique identifier of the invitation","type":"string","safeType":"string","required":true,"displayName":"»» id"},{"schema":{"type":"string","example":"newuser@example.com","description":"The email address the invitation was sent to"},"in":"body","name":"email","depth":2,"description":"The email address the invitation was sent to","type":"string","safeType":"string","required":true,"displayName":"»» email"},{"schema":{"type":"string","enum":["ADMIN","STANDARD"],"example":"STANDARD","description":"The role of the user in the organisation"},"in":"body","name":"role","depth":2,"description":"The role of the user in the organisation","type":"string","safeType":"string","required":true,"displayName":"»» role"},{"schema":{"type":"string","example":"2024-01-15T10:30:00Z","description":"When the invitation was created"},"in":"body","name":"created_at","depth":2,"description":"When the invitation was created","type":"string","safeType":"string","required":true,"displayName":"»» created_at"},{"schema":{"type":"boolean","default":true,"example":true,"description":"Whether the API call was successful"},"in":"body","name":"success","depth":1,"description":"Whether the API call was successful","type":"boolean","safeType":"boolean","required":true,"displayName":"» success"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"errors","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» errors"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"},{"schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"number"},"message":{"type":"string"},"type":{"type":"string"}},"required":["code","message"]},"example":[]},"in":"body","name":"messages","depth":1,"type":"array","safeType":"object[]","required":true,"displayName":"» messages"},{"schema":{"type":"number"},"in":"body","name":"code","depth":2,"type":"number","safeType":"number","required":true,"displayName":"»» code"},{"schema":{"type":"string"},"in":"body","name":"message","depth":2,"type":"string","safeType":"string","required":true,"displayName":"»» message"},{"schema":{"type":"string"},"in":"body","name":"type","depth":2,"type":"string","safeType":"string","required":false,"displayName":"»» type"}]}]} />

</Col>

<Col sticky>

<CodeGroup title="Request" tag="POST" label="/v1/invitations">
```bash {{ title: 'cURL' }}
curl --request POST \
  --url https://api.onlineornot.com/v1/invitations \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access-token}' \
  --header 'Content-Type: application/json' \
  --data '{"email":"newuser@example.com","role":"STANDARD"}'
```

```javascript
fetch("https://api.onlineornot.com/v1/invitations", {
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
  },
  "body": "{\"email\":\"newuser@example.com\",\"role\":\"STANDARD\"}"
})
.then(response => {
  console.log(response);
})
.catch(err => {
  console.error(err);
});
```

```java
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"email\":\"newuser@example.com\",\"role\":\"STANDARD\"}");
Request request = new Request.Builder()
  .url("https://api.onlineornot.com/v1/invitations")
  .post(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "Bearer {access-token}")
  .build();

Response response = client.newCall(request).execute();
```

```php
<?php

$request = new HttpRequest();
$request->setUrl('https://api.onlineornot.com/v1/invitations');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders([
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
]);

$request->setBody('{"email":"newuser@example.com","role":"STANDARD"}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
```

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

url = URI("https://api.onlineornot.com/v1/invitations")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["Accept"] = 'application/json'
request["Authorization"] = 'Bearer {access-token}'
request.body = "{\"email\":\"newuser@example.com\",\"role\":\"STANDARD\"}"

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

```python
import requests

url = "https://api.onlineornot.com/v1/invitations"

payload = {
    "email": "newuser@example.com",
    "role": "STANDARD"
}
headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Authorization": "Bearer {access-token}"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
```

</CodeGroup>

```json {{ title: 'Response' }}
{
  "result": {
    "id": "inv123",
    "email": "newuser@example.com",
    "role": "STANDARD",
    "created_at": "2024-01-15T10:30:00Z"
  },
  "success": true,
  "errors": [],
  "messages": []
}
```

</Col>
</Row>

---

