mirror of
https://github.com/netbirdio/docs.git
synced 2026-04-18 16:36:35 +00:00
54 lines
10 KiB
Plaintext
54 lines
10 KiB
Plaintext
---
|
|
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":"<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 Setup Key
|
|
|
|
|
|
|
|
Creates a Setup Key
|
|
|
|
<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"}}>
|
|
|
|
New Setup Key request
|
|
|
|
</div></div><ul style={{"marginLeft":"1rem"}}><SchemaItem collapsible={false} name={"name"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Setup Key name","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"type"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Setup key type, one-off for single time usage and reusable","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"expires_in"} required={true} schemaName={"integer"} qualifierMessage={undefined} schema={{"description":"Expiration time in seconds","type":"integer"}}></SchemaItem><SchemaItem collapsible={false} name={"revoked"} required={true} schemaName={"boolean"} qualifierMessage={undefined} schema={{"description":"Setup key revocation status","type":"boolean"}}></SchemaItem><SchemaItem collapsible={false} name={"auto_groups"} required={true} schemaName={"string[]"} qualifierMessage={undefined} schema={{"description":"Setup key groups to auto-assign to peers registered with this key","type":"array","items":{"type":"string"}}}></SchemaItem><SchemaItem collapsible={false} name={"usage_limit"} required={true} schemaName={"integer"} qualifierMessage={undefined} schema={{"description":"A number of times this key can be used. The value of 0 indicates the unlimited usage.","type":"integer"}}></SchemaItem></ul></details></TabItem></MimeTabs><div><ApiTabs><TabItem label={"200"} value={"200"}><div>
|
|
|
|
A Setup Keys 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":"Setup Key ID","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"key"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Setup Key value","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"name"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Setup key name identifier","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"expires"} required={true} schemaName={"date-time"} qualifierMessage={undefined} schema={{"description":"Setup Key expiration date","type":"string","format":"date-time"}}></SchemaItem><SchemaItem collapsible={false} name={"type"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Setup key type, one-off for single time usage and reusable","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"valid"} required={true} schemaName={"boolean"} qualifierMessage={undefined} schema={{"description":"Setup key validity status","type":"boolean"}}></SchemaItem><SchemaItem collapsible={false} name={"revoked"} required={true} schemaName={"boolean"} qualifierMessage={undefined} schema={{"description":"Setup key revocation status","type":"boolean"}}></SchemaItem><SchemaItem collapsible={false} name={"used_times"} required={true} schemaName={"integer"} qualifierMessage={undefined} schema={{"description":"Usage count of setup key","type":"integer"}}></SchemaItem><SchemaItem collapsible={false} name={"last_used"} required={true} schemaName={"date-time"} qualifierMessage={undefined} schema={{"description":"Setup key last usage date","type":"string","format":"date-time"}}></SchemaItem><SchemaItem collapsible={false} name={"state"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Setup key status, \"valid\", \"overused\",\"expired\" or \"revoked\"","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"auto_groups"} required={true} schemaName={"string[]"} qualifierMessage={undefined} schema={{"description":"Setup key groups to auto-assign to peers registered with this key","type":"array","items":{"type":"string"}}}></SchemaItem><SchemaItem collapsible={false} name={"updated_at"} required={true} schemaName={"date-time"} qualifierMessage={undefined} schema={{"description":"Setup key last update date","type":"string","format":"date-time"}}></SchemaItem><SchemaItem collapsible={false} name={"usage_limit"} required={true} schemaName={"integer"} qualifierMessage={undefined} schema={{"description":"A number of times this key can be used. The value of 0 indicates the unlimited usage.","type":"integer"}}></SchemaItem></ul></details></TabItem><TabItem label={"Example (from schema)"} value={"Example (from schema)"}><ResponseSamples responseExample={"{\n \"id\": \"string\",\n \"key\": \"string\",\n \"name\": \"string\",\n \"expires\": \"2023-04-26T12:12:56.627Z\",\n \"type\": \"string\",\n \"valid\": true,\n \"revoked\": true,\n \"used_times\": 0,\n \"last_used\": \"2023-04-26T12:12:56.627Z\",\n \"state\": \"string\",\n \"auto_groups\": [\n \"string\"\n ],\n \"updated_at\": \"2023-04-26T12:12:56.627Z\",\n \"usage_limit\": 0\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>
|
|
|