Files
authentik/website/docs/developer-docs/api/reference/core-tokens-create.api.mdx
Tana M Berry 7a6d44d0df first pass
2024-10-22 15:10:13 -05:00

763 lines
34 KiB
Plaintext

---
id: core-tokens-create
title: "core_tokens_create"
description: "Token Viewset"
sidebar_label: "core_tokens_create"
hide_title: true
hide_table_of_contents: true
api: eJztWG1v2zYQ/isEMWAfJluO26CtPy1rg8JAuwRNUmANPIOWGJkNTWok5cQ1/N93R0qWLMtuOnTDBuyLIVPHe3nuueOJa6pzbpgTWo1TOqKJNnzq9D1XdpoYzhynEU25TYzIUQhErvEt+Sj4g+UO3jqWWTq69VvpJKKG/1Fw637R6YqO1rCsHFcOH1meS5F4Y/Fni8rW1CZzvmD45FY5B/V69pkn7oDVK24Ek+ILNyCQG/TdCW5x+4IplvG0ock6I1QGgqqQks0krDlT8IguhHrHVebmdHQC/guHr+j7oIDMVoQVbg4+i/s9Ny68d5a4OXOEGU4WHbv65HrOLSe6FEa5AGZKmEpJkafhuXB6AXAkTMoVbhKW3EmWEa3kigiVIli8MqZKfSSBxxloX3LzYIQDdNH6QmQhj7ZPftOFl7JOSEkWOhV3K9BSe7QUzP8/uxxHZFY4wh9zr3rOVIYWdduCUIQRCe6Y0v0+3URUpBjwnYB8dOC+i/OCPVb/hqenkD4Gig2C+vttj/W+nPU+DXqvppOffvCat6zhqlggv8AZsBToA8pZLiiSLUEvV34hn+bM2gdtUuRh25sqz2Ov+Ry1gp3C7viOZjNY2bQS3w4O3gNkwgTutU3daQN5hRUEqufEgu+xsFKAG2oNM60lZ4puNqGOwECKsTdwntSR+Jr4EMoNtuzsKW1YnhSQQajEW6i/La1Ht5ONL1WbA2FCEMPByT9Zr/n9UeSKQqQ+vyy9gGqoSncndOKFNtG31P7/1f63Vft/rL7xzRQg8kyX8uLO18hxVt/AnieTurJ1mMXjN5UjikGPOA7qyekAhA8J7vv5oyWpsLlkK4KbQgbtlCVOLHlHz6ndOgsibaVvuBWZ8hx9mHMglAFWAYnRf2LnupAp8shV3IdS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4bGDOWKy8Hlrl/UmqnacJQnP3VHZSaOCLi+uEPZZeX248GVLDXvAcwt+oeIiqj1GvkL82hq+GVRWAMPhfdDp+1ixc0iXhRJVD43vPaZWDQ8BHi/hYQeIojIUF3r/BJT/CUVpVsw=
sidebar_class_name: "post api-method"
info_path: docs/developer-docs/api/reference/authentik
custom_edit_url: null
hide_send_button: true
---
import ApiTabs from "@theme/ApiTabs";
import DiscriminatorTabs from "@theme/DiscriminatorTabs";
import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint";
import SecuritySchemes from "@theme/ApiExplorer/SecuritySchemes";
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 Heading from "@theme/Heading";
import OperationTabs from "@theme/OperationTabs";
import TabItem from "@theme/TabItem";
<Heading
as={"h1"}
className={"openapi__heading"}
children={"core_tokens_create"}
>
</Heading>
<MethodEndpoint
method={"post"}
path={"/core/tokens/"}
>
</MethodEndpoint>
Token Viewset
<Heading
id={"request"}
as={"h2"}
className={"openapi-tabs__heading"}
children={"Request"}
>
</Heading>
<MimeTabs
className={"openapi-tabs__mime"}
>
<TabItem
label={"application/json"}
value={"application/json-schema"}
>
<details
style={{}}
className={"openapi-markdown__details mime"}
data-collapsed={false}
open={true}
>
<summary
style={{}}
className={"openapi-markdown__details-summary-mime"}
>
<h3
className={"openapi-markdown__details-summary-header-body"}
>
Body
</h3><strong
className={"openapi-schema__required"}
>
required
</strong>
</summary><div
style={{"textAlign":"left","marginLeft":"1rem"}}
>
</div><ul
style={{"marginLeft":"1rem"}}
>
<SchemaItem
collapsible={false}
name={"managed"}
required={false}
schemaName={"Managed by authentik (string)"}
qualifierMessage={"**Possible values:** `non-empty`"}
schema={{"type":"string","nullable":true,"minLength":1,"title":"Managed by authentik","description":"Objects that are managed by authentik. These objects are created and updated automatically. This flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update."}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"identifier"}
required={true}
schemaName={"string"}
qualifierMessage={"**Possible values:** `non-empty` and `<= 255 characters`, Value must match regular expression `^[-a-zA-Z0-9_]+$`"}
schema={{"type":"string","minLength":1,"maxLength":255,"pattern":"^[-a-zA-Z0-9_]+$"}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"intent"}
required={false}
schemaName={"IntentEnum (string)"}
qualifierMessage={"**Possible values:** [`verification`, `api`, `recovery`, `app_password`]"}
schema={{"enum":["verification","api","recovery","app_password"],"type":"string","title":"IntentEnum"}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"user"}
required={false}
schemaName={"integer"}
qualifierMessage={undefined}
schema={{"type":"integer"}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"description"}
required={false}
schemaName={"string"}
qualifierMessage={undefined}
schema={{"type":"string"}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"expires"}
required={false}
schemaName={"date-time"}
qualifierMessage={undefined}
schema={{"type":"string","format":"date-time","nullable":true}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"expiring"}
required={false}
schemaName={"boolean"}
qualifierMessage={undefined}
schema={{"type":"boolean"}}
>
</SchemaItem>
</ul>
</details>
</TabItem>
</MimeTabs><div>
<div>
<ApiTabs
label={undefined}
id={undefined}
>
<TabItem
label={"201"}
value={"201"}
>
<div>
</div><div>
<MimeTabs
className={"openapi-tabs__mime"}
schemaType={"response"}
>
<TabItem
label={"application/json"}
value={"application/json"}
>
<SchemaTabs
className={"openapi-tabs__schema"}
>
<TabItem
label={"Schema"}
value={"Schema"}
>
<details
style={{}}
className={"openapi-markdown__details response"}
data-collapsed={false}
open={true}
>
<summary
style={{}}
className={"openapi-markdown__details-summary-response"}
>
<strong>
Schema
</strong>
</summary><div
style={{"textAlign":"left","marginLeft":"1rem"}}
>
</div><ul
style={{"marginLeft":"1rem"}}
>
<SchemaItem
collapsible={false}
name={"pk"}
required={true}
schemaName={"uuid"}
qualifierMessage={undefined}
schema={{"type":"string","format":"uuid","readOnly":true,"title":"Token uuid"}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"managed"}
required={false}
schemaName={"Managed by authentik (string)"}
qualifierMessage={undefined}
schema={{"type":"string","nullable":true,"title":"Managed by authentik","description":"Objects that are managed by authentik. These objects are created and updated automatically. This flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update."}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"identifier"}
required={true}
schemaName={"string"}
qualifierMessage={"**Possible values:** `<= 255 characters`, Value must match regular expression `^[-a-zA-Z0-9_]+$`"}
schema={{"type":"string","maxLength":255,"pattern":"^[-a-zA-Z0-9_]+$"}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"intent"}
required={false}
schemaName={"IntentEnum (string)"}
qualifierMessage={"**Possible values:** [`verification`, `api`, `recovery`, `app_password`]"}
schema={{"enum":["verification","api","recovery","app_password"],"type":"string","title":"IntentEnum"}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"user"}
required={false}
schemaName={"integer"}
qualifierMessage={undefined}
schema={{"type":"integer"}}
>
</SchemaItem><SchemaItem
collapsible={true}
className={"schemaItem"}
>
<details
style={{}}
className={"openapi-markdown__details"}
>
<summary
style={{}}
>
<span
className={"openapi-schema__container"}
>
<strong
className={"openapi-schema__property"}
>
user_obj
</strong><span
className={"openapi-schema__name"}
>
object
</span><span
className={"openapi-schema__divider"}
>
</span><span
className={"openapi-schema__required"}
>
required
</span>
</span>
</summary><div
style={{"marginLeft":"1rem"}}
>
<div
style={{"marginTop":".5rem","marginBottom":".5rem"}}
>
User Serializer
</div><SchemaItem
collapsible={false}
name={"pk"}
required={true}
schemaName={"ID (integer)"}
qualifierMessage={undefined}
schema={{"type":"integer","readOnly":true,"title":"ID"}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"username"}
required={true}
schemaName={"string"}
qualifierMessage={"**Possible values:** `<= 150 characters`"}
schema={{"type":"string","maxLength":150}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"name"}
required={true}
schemaName={"string"}
qualifierMessage={undefined}
schema={{"type":"string","description":"User's display name."}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"is_active"}
required={false}
schemaName={"Active (boolean)"}
qualifierMessage={undefined}
schema={{"type":"boolean","title":"Active","description":"Designates whether this user should be treated as active. Unselect this instead of deleting accounts."}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"last_login"}
required={false}
schemaName={"date-time"}
qualifierMessage={undefined}
schema={{"type":"string","format":"date-time","nullable":true}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"is_superuser"}
required={true}
schemaName={"boolean"}
qualifierMessage={undefined}
schema={{"type":"boolean","readOnly":true}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"groups"}
required={false}
schemaName={"uuid[]"}
qualifierMessage={undefined}
schema={{"type":"array","items":{"type":"string","format":"uuid"}}}
>
</SchemaItem><SchemaItem
collapsible={true}
className={"schemaItem"}
>
<details
style={{}}
className={"openapi-markdown__details"}
>
<summary
style={{}}
>
<span
className={"openapi-schema__container"}
>
<strong
className={"openapi-schema__property"}
>
groups_obj
</strong><span
className={"openapi-schema__name"}
>
object[]
</span><span
className={"openapi-schema__divider"}
>
</span><span
className={"openapi-schema__nullable"}
>
nullable
</span><span
className={"openapi-schema__required"}
>
required
</span>
</span>
</summary><div
style={{"marginLeft":"1rem"}}
>
<li>
<div
style={{"fontSize":"var(--ifm-code-font-size)","opacity":"0.6","marginLeft":"-.5rem","paddingBottom":".5rem"}}
>
Array [
</div>
</li><SchemaItem
collapsible={false}
name={"pk"}
required={true}
schemaName={"uuid"}
qualifierMessage={undefined}
schema={{"type":"string","format":"uuid","readOnly":true,"title":"Group uuid"}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"num_pk"}
required={true}
schemaName={"integer"}
qualifierMessage={undefined}
schema={{"type":"integer","description":"Get a numerical, int32 ID for the group","readOnly":true}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"name"}
required={true}
schemaName={"string"}
qualifierMessage={undefined}
schema={{"type":"string"}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"is_superuser"}
required={false}
schemaName={"boolean"}
qualifierMessage={undefined}
schema={{"type":"boolean","description":"Users added to this group will be superusers."}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"parent"}
required={false}
schemaName={"uuid"}
qualifierMessage={undefined}
schema={{"type":"string","format":"uuid","nullable":true}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"parent_name"}
required={true}
schemaName={"string"}
qualifierMessage={undefined}
schema={{"type":"string","readOnly":true,"nullable":true}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"attributes"}
required={false}
schemaName={"object"}
qualifierMessage={undefined}
schema={{"type":"object"}}
>
</SchemaItem><li>
<div
style={{"fontSize":"var(--ifm-code-font-size)","opacity":"0.6","marginLeft":"-.5rem"}}
>
]
</div>
</li>
</div>
</details>
</SchemaItem><SchemaItem
collapsible={false}
name={"email"}
required={false}
schemaName={"email"}
qualifierMessage={"**Possible values:** `<= 254 characters`"}
schema={{"type":"string","format":"email","title":"Email address","maxLength":254}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"avatar"}
required={true}
schemaName={"string"}
qualifierMessage={undefined}
schema={{"type":"string","description":"User's avatar, either a http/https URL or a data URI","readOnly":true}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"attributes"}
required={false}
schemaName={"object"}
qualifierMessage={undefined}
schema={{"type":"object"}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"uid"}
required={true}
schemaName={"string"}
qualifierMessage={undefined}
schema={{"type":"string","readOnly":true}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"path"}
required={false}
schemaName={"string"}
qualifierMessage={undefined}
schema={{"type":"string"}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"type"}
required={false}
schemaName={"UserTypeEnum (string)"}
qualifierMessage={"**Possible values:** [`internal`, `external`, `service_account`, `internal_service_account`]"}
schema={{"enum":["internal","external","service_account","internal_service_account"],"type":"string","title":"UserTypeEnum"}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"uuid"}
required={true}
schemaName={"uuid"}
qualifierMessage={undefined}
schema={{"type":"string","format":"uuid","readOnly":true}}
>
</SchemaItem>
</div>
</details>
</SchemaItem><SchemaItem
collapsible={false}
name={"description"}
required={false}
schemaName={"string"}
qualifierMessage={undefined}
schema={{"type":"string"}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"expires"}
required={false}
schemaName={"date-time"}
qualifierMessage={undefined}
schema={{"type":"string","format":"date-time","nullable":true}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"expiring"}
required={false}
schemaName={"boolean"}
qualifierMessage={undefined}
schema={{"type":"boolean"}}
>
</SchemaItem>
</ul>
</details>
</TabItem><TabItem
label={"Example (from schema)"}
value={"Example (from schema)"}
>
<ResponseSamples
responseExample={"{\n \"pk\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n \"managed\": \"string\",\n \"identifier\": \"string\",\n \"intent\": \"verification\",\n \"user\": 0,\n \"user_obj\": {\n \"pk\": 0,\n \"username\": \"string\",\n \"name\": \"string\",\n \"is_active\": true,\n \"last_login\": \"2024-07-29T15:51:28.071Z\",\n \"is_superuser\": true,\n \"groups\": [\n \"3fa85f64-5717-4562-b3fc-2c963f66afa6\"\n ],\n \"groups_obj\": [\n {\n \"pk\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n \"num_pk\": 0,\n \"name\": \"string\",\n \"is_superuser\": true,\n \"parent\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n \"parent_name\": \"string\",\n \"attributes\": {}\n }\n ],\n \"email\": \"user@example.com\",\n \"avatar\": \"string\",\n \"attributes\": {},\n \"uid\": \"string\",\n \"path\": \"string\",\n \"type\": \"internal\",\n \"uuid\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\"\n },\n \"description\": \"string\",\n \"expires\": \"2024-07-29T15:51:28.071Z\",\n \"expiring\": true\n}"}
language={"json"}
>
</ResponseSamples>
</TabItem>
</SchemaTabs>
</TabItem>
</MimeTabs>
</div>
</TabItem><TabItem
label={"400"}
value={"400"}
>
<div>
</div><div>
<MimeTabs
className={"openapi-tabs__mime"}
schemaType={"response"}
>
<TabItem
label={"application/json"}
value={"application/json"}
>
<SchemaTabs
className={"openapi-tabs__schema"}
>
<TabItem
label={"Schema"}
value={"Schema"}
>
<details
style={{}}
className={"openapi-markdown__details response"}
data-collapsed={false}
open={true}
>
<summary
style={{}}
className={"openapi-markdown__details-summary-response"}
>
<strong>
Schema
</strong>
</summary><div
style={{"textAlign":"left","marginLeft":"1rem"}}
>
</div><ul
style={{"marginLeft":"1rem"}}
>
<SchemaItem
collapsible={false}
name={"non_field_errors"}
required={false}
schemaName={"string[]"}
qualifierMessage={undefined}
schema={{"type":"array","items":{"type":"string"}}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"code"}
required={false}
schemaName={"string"}
qualifierMessage={undefined}
schema={{"type":"string"}}
>
</SchemaItem><SchemaItem
name={"property name*"}
required={false}
schemaName={"any"}
qualifierMessage={undefined}
schema={{"type":"object","description":"Validation Error","properties":{"non_field_errors":{"type":"array","items":{"type":"string"}},"code":{"type":"string"}},"additionalProperties":{},"title":"ValidationError"}}
collapsible={false}
discriminator={false}
>
</SchemaItem>
</ul>
</details>
</TabItem><TabItem
label={"Example (from schema)"}
value={"Example (from schema)"}
>
<ResponseSamples
responseExample={"{\n \"non_field_errors\": [\n \"string\"\n ],\n \"code\": \"string\"\n}"}
language={"json"}
>
</ResponseSamples>
</TabItem>
</SchemaTabs>
</TabItem>
</MimeTabs>
</div>
</TabItem><TabItem
label={"403"}
value={"403"}
>
<div>
</div><div>
<MimeTabs
className={"openapi-tabs__mime"}
schemaType={"response"}
>
<TabItem
label={"application/json"}
value={"application/json"}
>
<SchemaTabs
className={"openapi-tabs__schema"}
>
<TabItem
label={"Schema"}
value={"Schema"}
>
<details
style={{}}
className={"openapi-markdown__details response"}
data-collapsed={false}
open={true}
>
<summary
style={{}}
className={"openapi-markdown__details-summary-response"}
>
<strong>
Schema
</strong>
</summary><div
style={{"textAlign":"left","marginLeft":"1rem"}}
>
</div><ul
style={{"marginLeft":"1rem"}}
>
<SchemaItem
collapsible={false}
name={"detail"}
required={true}
schemaName={"string"}
qualifierMessage={undefined}
schema={{"type":"string"}}
>
</SchemaItem><SchemaItem
collapsible={false}
name={"code"}
required={false}
schemaName={"string"}
qualifierMessage={undefined}
schema={{"type":"string"}}
>
</SchemaItem>
</ul>
</details>
</TabItem><TabItem
label={"Example (from schema)"}
value={"Example (from schema)"}
>
<ResponseSamples
responseExample={"{\n \"detail\": \"string\",\n \"code\": \"string\"\n}"}
language={"json"}
>
</ResponseSamples>
</TabItem>
</SchemaTabs>
</TabItem>
</MimeTabs>
</div>
</TabItem>
</ApiTabs>
</div>
</div>