--- id: create-user title: "Create a User" description: "Creates a new service user or sends an invite to a regular user" sidebar_label: "Create a User" hide_title: true hide_table_of_contents: true api: {"description":"Creates a new service user or sends an invite to a regular user","tags":["Users"],"operationId":"createUser","security":[{"BearerAuth":[]},{"TokenAuth":[]}],"requestBody":{"description":"User invite information","content":{"application/json":{"schema":{"type":"object","properties":{"email":{"description":"User's Email to send invite to","type":"string"},"name":{"description":"User's full name","type":"string"},"role":{"description":"User's NetBird account role","type":"string"},"auto_groups":{"description":"Groups to auto-assign to peers registered by this user","type":"array","items":{"type":"string"}},"is_service_user":{"description":"Is true if this user is a service user","type":"boolean"}},"required":["role","auto_groups","is_service_user"],"title":"UserCreateRequest"}}}},"responses":{"200":{"description":"A User object","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"description":"User ID","type":"string"},"email":{"description":"User's email address","type":"string"},"name":{"description":"User's name from idp provider","type":"string"},"role":{"description":"User's NetBird account role","type":"string"},"status":{"description":"User's status","type":"string","enum":["active","invited","disabled"]},"auto_groups":{"description":"Groups to auto-assign to peers registered by this user","type":"array","items":{"type":"string"}},"is_current":{"description":"Is true if authenticated user is the same as this user","type":"boolean","readOnly":true},"is_service_user":{"description":"Is true if this user is a service user","type":"boolean","readOnly":true}},"required":["id","email","name","role","auto_groups","status"],"title":"User"}}}},"400":{"description":"Bad Request","content":{}},"401":{"description":"Requires authentication","content":{}},"403":{"description":"Forbidden","content":{}},"500":{"description":"Internal Server Error","content":{}}},"method":"post","path":"/api/users","servers":[{"url":"https://netbird.io","description":"Default server"}],"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"TokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Prefix the value with \\\"Token\\\" to indicate the custom authorization type"}},"jsonRequestBodyExample":{"email":"string","name":"string","role":"string","auto_groups":["string"],"is_service_user":true},"info":{"title":"NetBird REST API","description":"API to manipulate groups, rules, policies and retrieve information about peers and users","version":"0.0.1"},"postman":{"name":"Create a User","description":{"content":"Creates a new service user or sends an invite to a regular user","type":"text/plain"},"url":{"path":["api","users"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}},"auth":{"type":"bearer","bearer":[{"type":"any","value":"","key":"token"}]}}} sidebar_class_name: "post api-method" info_path: api/netbird-rest-api custom_edit_url: null --- import ApiTabs from "@theme/ApiTabs"; import MimeTabs from "@theme/MimeTabs"; import ParamsItem from "@theme/ParamsItem"; import ResponseSamples from "@theme/ResponseSamples"; import SchemaItem from "@theme/SchemaItem"; import SchemaTabs from "@theme/SchemaTabs"; import DiscriminatorTabs from "@theme/DiscriminatorTabs"; import TabItem from "@theme/TabItem"; ## Create a User Creates a new service user or sends an invite to a regular user
Request Body
User invite information
A User object
Schema
Bad Request
Requires authentication
Forbidden
Internal Server Error