--- id: create-a-setup-key title: "Create a Setup Key" description: "Creates a Setup Key" sidebar_label: "Create a Setup Key" hide_title: true hide_table_of_contents: true api: {"description":"Creates a Setup Key","tags":["Setup Keys"],"security":[{"BearerAuth":[]},{"TokenAuth":[]}],"requestBody":{"description":"New Setup Key request","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"description":"Setup Key name","type":"string"},"type":{"description":"Setup key type, one-off for single time usage and reusable","type":"string"},"expires_in":{"description":"Expiration time in seconds","type":"integer"},"revoked":{"description":"Setup key revocation status","type":"boolean"},"auto_groups":{"description":"Setup key groups to auto-assign to peers registered with this key","type":"array","items":{"type":"string"}},"usage_limit":{"description":"A number of times this key can be used. The value of 0 indicates the unlimited usage.","type":"integer"}},"required":["name","type","expires_in","revoked","auto_groups","usage_limit"],"title":"SetupKeyRequest"}}}},"responses":{"200":{"description":"A Setup Keys Object","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"description":"Setup Key ID","type":"string"},"key":{"description":"Setup Key value","type":"string"},"name":{"description":"Setup key name identifier","type":"string"},"expires":{"description":"Setup Key expiration date","type":"string","format":"date-time"},"type":{"description":"Setup key type, one-off for single time usage and reusable","type":"string"},"valid":{"description":"Setup key validity status","type":"boolean"},"revoked":{"description":"Setup key revocation status","type":"boolean"},"used_times":{"description":"Usage count of setup key","type":"integer"},"last_used":{"description":"Setup key last usage date","type":"string","format":"date-time"},"state":{"description":"Setup key status, \"valid\", \"overused\",\"expired\" or \"revoked\"","type":"string"},"auto_groups":{"description":"Setup key groups to auto-assign to peers registered with this key","type":"array","items":{"type":"string"}},"updated_at":{"description":"Setup key last update date","type":"string","format":"date-time"},"usage_limit":{"description":"A number of times this key can be used. The value of 0 indicates the unlimited usage.","type":"integer"}},"required":["id","key","name","expires","type","valid","revoked","used_times","last_used","state","auto_groups","updated_at","usage_limit"],"title":"SetupKey"}}}},"400":{"description":"Bad Request","content":{}},"401":{"description":"Requires authentication","content":{}},"403":{"description":"Forbidden","content":{}},"500":{"description":"Internal Server Error","content":{}}},"method":"post","path":"/api/setup-keys","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":{"name":"string","type":"string","expires_in":0,"revoked":true,"auto_groups":["string"],"usage_limit":0},"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 Setup Key","description":{"content":"Creates a Setup Key","type":"text/plain"},"url":{"path":["api","setup-keys"],"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 Setup Key Creates a Setup Key
Request Body
New Setup Key request
A Setup Keys Object
Schema
Bad Request
Requires authentication
Forbidden
Internal Server Error