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

# Invites a user to a workspace.

POST https://api.awork.com/api/v1/invitations
Content-Type: application/json

Allows unauthenticated access.

Reference: https://developers.awork.com/apiv1/invitations/post-invitations

## Authentication

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

## Request

### Body (application/json)

This endpoint expects an Invitation.

- `workspaceId` (string, optional, nullable) — The id of the workspace to invite the user to. If not set, a new workspace will be created.
- `invitationFlow` (string, optional, nullable) — The current invitation flow. Use 'invite' for an invitation from a system admin, 'new_user_new_workspace' for an invitation when creating a workspace for a new user or 'existing_user_new_workspace' when creating a workspace for an existing user.
- `roleId` (string, optional, nullable) — The id of the role to which the new user should be added.
- `connectInviteCode` (string, optional, nullable) — The awork connect invite code.
- `passcode` (string, optional, nullable) — The bot prevention passcode.
- `email` (string, optional, nullable) — The email of the user to be invited.
- `password` (string, optional, nullable) — The Password of the user to be invited.
- `firstName` (string, optional, nullable) — The first name of the user to be invited.
- `lastName` (string, optional, nullable) — The last name of the user to be invited.
- `title` (string, optional, nullable) — The title of the user to be invited.
- `position` (string, optional, nullable) — The position of the user to be invited.
- `gender` (string, optional, nullable) — The gender of the user to be invited. Can be 'male', 'female' or 'other'.
- `skipSendingEmail` (boolean, optional) — If set to true, skips sending the welcome email. Important for batch invites.
- `teamIds` (list of string, optional, nullable) — The list of team ids where the user should be assigned to.
- `bookedSeats` (integer, optional, nullable) — The amount of booked seats.

## Response

### 200

OK

- `invitationCode` (string, optional, nullable) — The invitation code that is used to confirm the invitation. The code is valid for 24 hours.
- `passwordResetCode` (string, optional, nullable) — A code that is used to reset the user's password.
- `userId` (string, optional) — The id of the user that has been invited.
- `workspace` (Workspace, optional) — The workspace GET model.

## Errors

### 400 Bad Request Error

Bad Request

- `code` (string, required) — The error code.
- `description` (string, required) — The description of the error.
- `link` (string, required) — The link to the API documentation page.
- `details` (list of string, optional, nullable) — A list of details describing the error.
- `validationErrors` (list of ValidationErrorResponse, optional, nullable) — If a validation error occurred, this contains the validation errors for each property.
- `traceId` (string, optional, nullable) — The request trace id for tracking the request.

### 404 Not Found Error

Not Found

- `code` (string, required) — The error code.
- `description` (string, required) — The description of the error.
- `link` (string, required) — The link to the API documentation page.
- `details` (list of string, optional, nullable) — A list of details describing the error.
- `validationErrors` (list of ValidationErrorResponse, optional, nullable) — If a validation error occurred, this contains the validation errors for each property.
- `traceId` (string, optional, nullable) — The request trace id for tracking the request.

## Types

### Workspace

The workspace GET model.

- `allowSocialLogin` (boolean, required) — Whether the social login via apple and google is allowed.
- `allowCredentialsLogin` (boolean, required) — Whether the user can login with username and password.
- `name` (string, optional, nullable) — The workspace name. Optional.
- `description` (string, optional, nullable) — The workspace description. Optional.
- `language` (string, optional, nullable) — The workspace language. Optional.
- `type` (string, optional, nullable) — The workspace type / industry set during onboarding. Optional.
- `size` (string, optional, nullable) — The workspace size. Optional.
- `goals` (list of string, optional, nullable) — The workspace team goals. Optional.
- `selfAttribution` (string, optional, nullable) — The way the workspace creator learned awork, set during the onboarding. Optional.
- `previousTool` (string, optional, nullable) — The project management tool used before awork, set during the onboarding. Optional.
- `aiUsage` (string, optional, nullable) — How the team uses AI, set during the onboarding. Optional.
- `department` (string, optional, nullable) — The workspace creator's department, set during the onboarding. Optional.
- `allowAutomaticScimUserBooking` (boolean, optional, nullable) — Whether the SCIM integration should be able to book additional user seats when provisioning and activating new users, or should return BadRequest. Only admins are allowed to change this setting.
- `sameDomainSignupEnabled` (boolean, optional, nullable) — Whether same domain signup feature is enabled. Only admins are allowed to change this setting.
- `sameDomainSignupRoleId` (string, optional, nullable) — Default Role for users who sign up through same domain signup. Only admins are allowed to change this setting.
- `sameDomainSignupDomains` (list of string, optional, nullable) — Domains enabled for same domain signup feature. Only admins are allowed to change this setting.
- `requireMfa` (boolean, optional) — Whether the workspace requires multi-factor authentication for all users.
- `skipCreateDefaultWorkspaceData` (boolean, optional, nullable) — Whether to skip the creation of default workspace data.
- `id` (string, optional) — The id of the workspace.
- `subdomains` (list of SubdomainBase, optional, nullable) — The workspace's subdomains. Read-only.
- `memberCount` (integer, optional, nullable) — The amount of workspace members. Only visible when the user is authenticated. Read-only.
- `lastUsed` (boolean, optional) — Whether this is the workspace the current user last logged in with.
- `lastLogin` (string, optional, nullable) — The date and time the user last logged in with this workspace, or the workspace was last accessed.
- `accountIds` (list of string, optional, nullable) — The ids of identities assigned to this workspace. Read-only.
- `hasImage` (boolean, optional) — Whether the workspace has uploaded a workspace image.
- `createdOn` (string, optional) — The date this workspace was created.
- `createdBy` (string, optional, nullable) — The id of the user who created this workspace. Only set after the first invitation succeeded.
- `updatedOn` (string, optional) — The date this workspace was last modified.
- `updatedBy` (string, optional, nullable) — The id of the user who last updated this workspace. Only set after the first invitation succeeded.
- `isTestWorkspace` (boolean, optional) — Whether the workspace is a test workspace.
- `isApproved` (boolean, optional) — Whether the user accepted the invitation to the workspace.
- `allowSSOLogin` (boolean, optional) — Whether the user can login via an external SSO provider.
- `isScimActivated` (boolean, optional) — Whether the workspace has SCIM user provisioning enabled.
- `virtualMRR` (double, optional, nullable) — The virtual MRR calculated during onborading.
- `isMobileSignup` (boolean, optional, nullable) — The type of sign-up set during the onboarding. Can be: web, mobile, ...
- `isFreeMail` (boolean, optional, nullable) — Whether the domain of the account of the workspace creator is a freemail or a business domain.
- `isJoinable` (boolean, optional) — Whether this workspace has same domain sign up enabled and the account's email matches the permitted domains.
- `isFull` (boolean, optional, nullable) — Whether this workspace is full and no more users can join. Used in same domain sign up flow.

### ValidationErrorResponse

The validation error response.

- `property` (string, optional, nullable) — The name of the property that failed validation.
- `message` (string, optional, nullable) — The reason why this property failed validation.

### SubdomainBase

The base subdomain model.

- `name` (string, optional, nullable) — The subdomain hostname.
- `isDefault` (boolean, optional) — Whether this is the default subdomain of the workspace.

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "invitationCode": "a368cfdb4=",
  "passwordResetCode": "f84ab34=",
  "userId": "123e4567-e89b-12d3-a456-426614174000",
  "workspace": {
    "allowSocialLogin": true,
    "allowCredentialsLogin": true,
    "name": "NCNSTN Creative Agency",
    "description": "We create awesome digital experiences.",
    "language": "de-DE",
    "type": "creative-agency",
    "size": "15",
    "goals": [
      "string"
    ],
    "selfAttribution": "string",
    "previousTool": "string",
    "aiUsage": "string",
    "department": "15",
    "allowAutomaticScimUserBooking": true,
    "sameDomainSignupEnabled": true,
    "sameDomainSignupRoleId": "123e4567-e89b-12d3-a456-426614174000",
    "sameDomainSignupDomains": [
      "string"
    ],
    "requireMfa": true,
    "skipCreateDefaultWorkspaceData": true,
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "subdomains": [
      {
        "name": "ncnstn",
        "isDefault": true
      }
    ],
    "memberCount": 25,
    "lastUsed": true,
    "lastLogin": "2024-01-15T09:30:00Z",
    "accountIds": [
      "string"
    ],
    "hasImage": true,
    "createdOn": "2024-01-15T09:30:00Z",
    "createdBy": "123e4567-e89b-12d3-a456-426614174000",
    "updatedOn": "2024-01-15T09:30:00Z",
    "updatedBy": "123e4567-e89b-12d3-a456-426614174000",
    "isTestWorkspace": false,
    "isApproved": true,
    "allowSSOLogin": true,
    "isScimActivated": true,
    "virtualMRR": 1.1,
    "isMobileSignup": true,
    "isFreeMail": true,
    "isJoinable": true,
    "isFull": true
  }
}
```

**SDK Code**

```python
import requests

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

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.awork.com/api/v1/invitations';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

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

```go
package main

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

func main() {

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

	payload := strings.NewReader("{}")

	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
require 'uri'
require 'net/http'

url = URI("https://api.awork.com/api/v1/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 = "{}"

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

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

HttpResponse<String> response = Unirest.post("https://api.awork.com/api/v1/invitations")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.awork.com/api/v1/invitations', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.awork.com/api/v1/invitations");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.awork.com/api/v1/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()
```