Files
netbird-docs/docs/api/create-user.api.mdx
2023-04-26 15:06:59 +02:00

54 lines
8.2 KiB
Plaintext

---
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":"<Bearer Token>","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
<MimeTabs><TabItem label={"application/json"} value={"application/json-schema"}><details style={{}} data-collapsed={false} open={true}><summary style={{"textAlign":"left"}}><strong>Request Body</strong></summary><div style={{"textAlign":"left","marginLeft":"1rem"}}><div style={{"marginTop":"1rem","marginBottom":"1rem"}}>
User invite information
</div></div><ul style={{"marginLeft":"1rem"}}><SchemaItem collapsible={false} name={"email"} required={false} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"User's Email to send invite to","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"name"} required={false} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"User's full name","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"role"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"User's NetBird account role","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"auto_groups"} required={true} schemaName={"string[]"} qualifierMessage={undefined} schema={{"description":"Groups to auto-assign to peers registered by this user","type":"array","items":{"type":"string"}}}></SchemaItem><SchemaItem collapsible={false} name={"is_service_user"} required={true} schemaName={"boolean"} qualifierMessage={undefined} schema={{"description":"Is true if this user is a service user","type":"boolean"}}></SchemaItem></ul></details></TabItem></MimeTabs><div><ApiTabs><TabItem label={"200"} value={"200"}><div>
A User object
</div><div><MimeTabs schemaType={"response"}><TabItem label={"application/json"} value={"application/json"}><SchemaTabs><TabItem label={"Schema"} value={"Schema"}><details style={{}} data-collapsed={false} open={true}><summary style={{"textAlign":"left"}}><strong>Schema</strong></summary><div style={{"textAlign":"left","marginLeft":"1rem"}}></div><ul style={{"marginLeft":"1rem"}}><SchemaItem collapsible={false} name={"id"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"User ID","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"email"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"User's email address","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"name"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"User's name from idp provider","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"role"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"User's NetBird account role","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"status"} required={true} schemaName={"string"} qualifierMessage={"**Possible values:** [`active`, `invited`, `disabled`]"} schema={{"description":"User's status","type":"string","enum":["active","invited","disabled"]}}></SchemaItem><SchemaItem collapsible={false} name={"auto_groups"} required={true} schemaName={"string[]"} qualifierMessage={undefined} schema={{"description":"Groups to auto-assign to peers registered by this user","type":"array","items":{"type":"string"}}}></SchemaItem><SchemaItem collapsible={false} name={"is_current"} required={false} schemaName={"boolean"} qualifierMessage={undefined} schema={{"description":"Is true if authenticated user is the same as this user","type":"boolean","readOnly":true}}></SchemaItem><SchemaItem collapsible={false} name={"is_service_user"} required={false} schemaName={"boolean"} qualifierMessage={undefined} schema={{"description":"Is true if this user is a service user","type":"boolean","readOnly":true}}></SchemaItem></ul></details></TabItem><TabItem label={"Example (from schema)"} value={"Example (from schema)"}><ResponseSamples responseExample={"{\n \"id\": \"string\",\n \"email\": \"string\",\n \"name\": \"string\",\n \"role\": \"string\",\n \"status\": \"active\",\n \"auto_groups\": [\n \"string\"\n ],\n \"is_current\": true,\n \"is_service_user\": true\n}"} language={"json"}></ResponseSamples></TabItem></SchemaTabs></TabItem></MimeTabs></div></TabItem><TabItem label={"400"} value={"400"}><div>
Bad Request
</div><div></div></TabItem><TabItem label={"401"} value={"401"}><div>
Requires authentication
</div><div></div></TabItem><TabItem label={"403"} value={"403"}><div>
Forbidden
</div><div></div></TabItem><TabItem label={"500"} value={"500"}><div>
Internal Server Error
</div><div></div></TabItem></ApiTabs></div>