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

50 lines
6.2 KiB
Plaintext

---
id: get-token
title: "Retrieve a Token"
description: "Returns a specific token for a user"
sidebar_label: "Retrieve a Token"
hide_title: true
hide_table_of_contents: true
api: {"description":"Returns a specific token for a user","tags":["Tokens"],"operationId":"getToken","security":[{"BearerAuth":[]},{"TokenAuth":[]}],"parameters":[{"in":"path","name":"userId","required":true,"schema":{"type":"string"},"description":"The unique identifier of a user"},{"in":"path","name":"tokenId","required":true,"schema":{"type":"string"},"description":"The unique identifier of a token"}],"responses":{"200":{"description":"A PersonalAccessTokens Object","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"description":"ID of a token","type":"string"},"name":{"description":"Name of the token","type":"string"},"expiration_date":{"description":"Date the token expires","type":"string","format":"date-time"},"created_by":{"description":"User ID of the user who created the token","type":"string"},"created_at":{"description":"Date the token was created","type":"string","format":"date-time"},"last_used":{"description":"Date the token was last used","type":"string","format":"date-time"}},"required":["id","name","expiration_date","created_by","created_at"],"title":"PersonalAccessToken"}}}},"400":{"description":"Bad Request","content":{}},"401":{"description":"Requires authentication","content":{}},"403":{"description":"Forbidden","content":{}},"500":{"description":"Internal Server Error","content":{}}},"method":"get","path":"/api/users/{userId}/tokens/{tokenId}","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"}},"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":"Retrieve a Token","description":{"content":"Returns a specific token for a user","type":"text/plain"},"url":{"path":["api","users",":userId","tokens",":tokenId"],"host":["{{baseUrl}}"],"query":[],"variable":[{"disabled":false,"description":{"content":"(Required) The unique identifier of a user","type":"text/plain"},"type":"any","value":"","key":"userId"},{"disabled":false,"description":{"content":"(Required) The unique identifier of a token","type":"text/plain"},"type":"any","value":"","key":"tokenId"}]},"header":[{"key":"Accept","value":"application/json"}],"method":"GET","auth":{"type":"bearer","bearer":[{"type":"any","value":"<Bearer Token>","key":"token"}]}}}
sidebar_class_name: "get 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";
## Retrieve a Token
Returns a specific token for a user
<details style={{"marginBottom":"1rem"}} data-collapsed={false} open={true}><summary style={{}}><strong>Path Parameters</strong></summary><div><ul><ParamsItem className={"paramsItem"} param={{"in":"path","name":"userId","required":true,"schema":{"type":"string"},"description":"The unique identifier of a user"}}></ParamsItem><ParamsItem className={"paramsItem"} param={{"in":"path","name":"tokenId","required":true,"schema":{"type":"string"},"description":"The unique identifier of a token"}}></ParamsItem></ul></div></details><div><ApiTabs><TabItem label={"200"} value={"200"}><div>
A PersonalAccessTokens 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":"ID of a token","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"name"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Name of the token","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"expiration_date"} required={true} schemaName={"date-time"} qualifierMessage={undefined} schema={{"description":"Date the token expires","type":"string","format":"date-time"}}></SchemaItem><SchemaItem collapsible={false} name={"created_by"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"User ID of the user who created the token","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"created_at"} required={true} schemaName={"date-time"} qualifierMessage={undefined} schema={{"description":"Date the token was created","type":"string","format":"date-time"}}></SchemaItem><SchemaItem collapsible={false} name={"last_used"} required={false} schemaName={"date-time"} qualifierMessage={undefined} schema={{"description":"Date the token was last used","type":"string","format":"date-time"}}></SchemaItem></ul></details></TabItem><TabItem label={"Example (from schema)"} value={"Example (from schema)"}><ResponseSamples responseExample={"{\n \"id\": \"string\",\n \"name\": \"string\",\n \"expiration_date\": \"2023-04-26T12:12:56.621Z\",\n \"created_by\": \"string\",\n \"created_at\": \"2023-04-26T12:12:56.621Z\",\n \"last_used\": \"2023-04-26T12:12:56.621Z\"\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>