> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://apidocs.polytomic.com/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://apidocs.polytomic.com/_mcp/server. # Create User POST https://app.polytomic.com/api/organizations/{org_id}/users Content-Type: application/json Creates a new user in the specified organization and assigns the requested permissions roles. > 🚧 Requires partner key > > User endpoints are only accessible using [partner keys](../../../../guides/obtaining-api-keys#partner-keys). Reference: https://apidocs.polytomic.com/api-reference/users/create ## Authentication - `Authorization` header (basic auth, required) — This is the Polytomic deployment key (on-premises only) - `Authorization` header (bearer token, required) — This is the Polytomic API key ## Request ### Path parameters - `org_id` (string, required) — Unique identifier of the organization the user belongs to. ### Body (application/json) This endpoint expects a V2CreateUserRequestSchema. - `email` (string, required) — Email address used to sign the user in and receive notifications. - `role_ids` (list of string, optional) — Identifiers of the permissions roles to assign to the user. Must contain at least one entry when provided. - `role` (string, optional, deprecated) — Deprecated legacy role name. Use role_ids instead; setting both role and role_ids in the same request is rejected. ## Response ### 200 OK - `data` (V2User, optional) ## Errors ### 401 Unauthorized Error Unauthorized - `code` (integer, optional) — Application-specific error code. - `context` (map from string to any, optional) — Application context. - `error` (string, optional) — Error message. - `status` (string, optional) — Status text. ### 403 Forbidden Error Forbidden - `key` (string, optional) - `message` (string, optional) - `metadata` (map from string to any, optional) - `status` (integer, optional) ### 422 Unprocessable Entity Error Unprocessable Entity - `key` (string, optional) - `message` (string, optional) - `metadata` (map from string to any, optional) - `status` (integer, optional) ### 500 Internal Server Error Internal Server Error - `key` (string, optional) - `message` (string, optional) - `metadata` (map from string to any, optional) - `status` (integer, optional) ## Types ### V2User - `email` (string, optional) — Email address used to sign in and receive notifications. - `id` (string, optional) — Unique identifier of the user. - `organization_id` (string, optional) — Unique identifier of the organization the user belongs to. - `role_ids` (list of string, optional, nullable) — Identifiers of the permissions roles assigned to the user. - `role` (string, optional, deprecated) — Deprecated legacy role name. Use role_ids instead. ## Examples **Request** ```json { "email": "jane.doe@acmecorp.com" } ``` **Response** ```json { "data": { "email": "jane.doe@acmecorp.com", "id": "a3f1c9e2-7b4d-4f8a-9c2e-1d2f3b4a5c6d", "organization_id": "248df4b7-aa70-47b8-a036-33ac447e668d", "role_ids": [ "d9f8e7c6-b5a4-4321-9f8e-7d6c5b4a3e2f" ], "role": "admin" } } ``` **SDK Code** ```typescript import { PolytomicClient } from "polytomic"; async function main() { const client = new PolytomicClient({ token: "YOUR_TOKEN_HERE", version: "X-Polytomic-Version", }); await client.users.create("248df4b7-aa70-47b8-a036-33ac447e668d", { email: "jane.doe@acmecorp.com", }); } main(); ``` ```python from polytomic import Polytomic client = Polytomic( token="YOUR_TOKEN_HERE", version="X-Polytomic-Version", ) client.users.create( org_id="248df4b7-aa70-47b8-a036-33ac447e668d", email="jane.doe@acmecorp.com", ) ``` ```go package example import ( context "context" polytomic "github.com/polytomic/polytomic-go/v24" client "github.com/polytomic/polytomic-go/v24/client" option "github.com/polytomic/polytomic-go/v24/option" ) func do() { client := client.NewClient( option.WithToken( "YOUR_TOKEN_HERE", ), option.WithVersion( "X-Polytomic-Version", ), ) request := &polytomic.CreateUserRequestSchema{ Email: "jane.doe@acmecorp.com", } client.Users.Create( context.TODO(), "248df4b7-aa70-47b8-a036-33ac447e668d", request, ) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://app.polytomic.com/api/organizations/248df4b7-aa70-47b8-a036-33ac447e668d/users") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["X-Polytomic-Version"] = 'X-Polytomic-Version' request.basic_auth("", "") request["Content-Type"] = 'application/json' request.body = "{\n \"email\": \"jane.doe@acmecorp.com\"\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://app.polytomic.com/api/organizations/248df4b7-aa70-47b8-a036-33ac447e668d/users") .header("X-Polytomic-Version", "X-Polytomic-Version") .basicAuth("", "") .header("Content-Type", "application/json") .body("{\n \"email\": \"jane.doe@acmecorp.com\"\n}") .asString(); ``` ```php request('POST', 'https://app.polytomic.com/api/organizations/248df4b7-aa70-47b8-a036-33ac447e668d/users', [ 'body' => '{ "email": "jane.doe@acmecorp.com" }', 'headers' => [ 'Content-Type' => 'application/json', 'X-Polytomic-Version' => 'X-Polytomic-Version', ], 'auth' => ['', ''], ]); echo $response->getBody(); ``` ```csharp using RestSharp; using RestSharp.Authenticators; var client = new RestClient("https://app.polytomic.com/api/organizations/248df4b7-aa70-47b8-a036-33ac447e668d/users"); client.Authenticator = new HttpBasicAuthenticator("", ""); var request = new RestRequest(Method.POST); request.AddHeader("X-Polytomic-Version", "X-Polytomic-Version"); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"email\": \"jane.doe@acmecorp.com\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let credentials = Data(":".utf8).base64EncodedString() let headers = [ "X-Polytomic-Version": "X-Polytomic-Version", "Authorization": "Basic \(credentials)", "Content-Type": "application/json" ] let parameters = ["email": "jane.doe@acmecorp.com"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://app.polytomic.com/api/organizations/248df4b7-aa70-47b8-a036-33ac447e668d/users")! 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() ```