> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.mixlayer.com/api-reference/platform-api/organizations/create-org-invite/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.mixlayer.com/_mcp/server. # Invite a user to an organization POST https://api.mixlayer.com/v1/organizations/{org_id}/invites Content-Type: application/json When authenticated with an API key, this operation requires `api-admin`. Reference: https://docs.mixlayer.com/api-reference/platform-api/organizations/create-org-invite ## Authentication - `Authorization` header (bearer token, required) — Console user session or Mixlayer API key supplied as a Bearer token. ## Request ### Path parameters - `org_id` (string, required) — Organization ID ### Body (application/json) This endpoint expects a CreateInviteRequest. - `email` (string, required) — Email address to invite. - `role` (enum, required) — Role assigned when the invitation is accepted: `owner` or `member`. - Allowed values: `owner`, `member` ## Response ### 201 Invitation created - `data` (ApiDataResponseInviteResponseData, required) — Pending organization invitation. ## Errors ### 400 Bad Request Error The request body contains malformed JSON or invalid values. - `error` (ApiErrorBody, required) — Structured error details. ### 401 Unauthorized Error Authentication is missing or invalid. - `error` (ApiErrorBody, required) — Structured error details. ### 403 Forbidden Error The authenticated principal cannot perform this operation. - `error` (ApiErrorBody, required) — Structured error details. ### 404 Not Found Error The requested resource is not visible to the authenticated principal. - `error` (ApiErrorBody, required) — Structured error details. ### 409 Conflict Error The user is already a member or has a pending invitation - `error` (ApiErrorBody, required) — Structured error details. ### 413 Content Too Large Error The request body exceeds the configured size limit. - `error` (ApiErrorBody, required) — Structured error details. ### 415 Unsupported Media Type Error The request does not have a JSON content type. - `error` (ApiErrorBody, required) — Structured error details. ### 422 Unprocessable Entity Error The JSON body does not match the request schema or contains a rejected field value. - `error` (ApiErrorBody, required) — Structured error details. ### 500 Internal Server Error An unexpected server or database error occurred. - `error` (ApiErrorBody, required) — Structured error details. ## Types ### ApiDataResponseInviteResponseData Pending organization invitation. - `created_at` (datetime, required) — Time the invitation was created. - `email` (string, required) — Email address receiving the invitation. - `expires_at` (datetime, required) — Time the invitation expires. - `id` (string, required) — Stable invitation identifier. - `invited_by` (InviteUserResponse, required) — Console user who sent the invitation. - `role` (enum, required) — Role assigned when the invitation is accepted. - Allowed values: `primary_owner`, `owner`, `member` ### ApiErrorBody Structured error details returned by the platform API. - `message` (string, required) — Human-readable error message. - `code` (string, optional, nullable) — Stable machine-readable error code, when available. - `details` (any, optional) — Error-specific structured context, when available. ### InviteUserResponse Console user who sent an organization invitation. - `email` (string, required) — Inviter's primary email address. - `id` (string, required) — Stable user identifier. - `name` (string, optional, nullable) — Inviter's display name, when available. ## Examples **Request** ```json { "email": "string", "role": "owner" } ``` **Response** ```json { "data": { "created_at": "2024-01-15T09:30:00Z", "email": "string", "expires_at": "2024-01-15T09:30:00Z", "id": "string", "invited_by": { "email": "string", "id": "string", "name": "string" }, "role": "primary_owner" } } ``` **SDK Code** ```python import requests url = "https://api.mixlayer.com/v1/organizations/org_id/invites" payload = { "email": "string", "role": "owner" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.mixlayer.com/v1/organizations/org_id/invites'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"email":"string","role":"owner"}' }; 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.mixlayer.com/v1/organizations/org_id/invites" payload := strings.NewReader("{\n \"email\": \"string\",\n \"role\": \"owner\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") 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.mixlayer.com/v1/organizations/org_id/invites") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"email\": \"string\",\n \"role\": \"owner\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.mixlayer.com/v1/organizations/org_id/invites") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"email\": \"string\",\n \"role\": \"owner\"\n}") .asString(); ``` ```php request('POST', 'https://api.mixlayer.com/v1/organizations/org_id/invites', [ 'body' => '{ "email": "string", "role": "owner" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ```