# Create Token

<Heading
  as={"h1"}
  className={"openapi__heading"}
  children={"Create Token"}
>
</Heading>

<MethodEndpoint
  method={"post"}
  path={"/api/v1/token"}
  context={"endpoint"}
>
  
</MethodEndpoint>

Creates the API key that you can use to connect Haystack Enterprise Platform to your application.

<Heading
  id={"request"}
  as={"h2"}
  className={"openapi-tabs__heading"}
  children={"Request"}
>
</Heading>

<ParamsDetails
  parameters={undefined}
>
  
</ParamsDetails>

<RequestSchema
  title={"Body"}
  body={{"content":{"application/json":{"schema":{"properties":{"expires":{"default":true,"description":"Specifies whether the API token expires.","title":"API Token Expires","type":"boolean"},"expires_at":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"description":"The date and time when the token expires. The timestamp is in the ISO 8601 format and follows the convention YYY-MM-DDTHH:MM:SS.sssZ. For more information, see [Date-Time](https://docs.cloud.deepset.ai/reference/api-best-practices#date-time).","title":"API Token Expiry"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The name of the API token.","title":"API Token Name"},"organization_role":{"default":"MEMBER","description":"The role of the API token in the organization. Defaults to the role of the user that created the token. Admin users can create tokens with any role.","title":"Organization Role","enum":["ADMIN","MEMBER","EXTERNAL"],"type":"string"},"personal":{"default":true,"description":"Indicates if the API token is a personal or service level token.","title":"API Token type","type":"boolean"},"role_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"description":"The ID of the role assigned to the API token. Defaults to the role of the user who created it. Admin users can create tokens with any role.","title":"API Token Role ID"},"workspaces":{"description":"The workspaces that the API token is associated with. Defaults to all workspaces that the user has access to. ","items":{"type":"string"},"title":"API Token Workspaces","type":"array"}},"title":"CreateToken","type":"object"}}},"required":true}}
>
  
</RequestSchema>

<StatusCodes
  id={undefined}
  label={undefined}
  responses={{"200":{"content":{"application/json":{"schema":{"properties":{"api_token":{"description":"API token with the prefix `api_`. This token inherits all permissions of the user that created it, and acts on behalf of this user.","title":"API Token","type":"string"},"api_token_id":{"description":"Unique identifier of the API token.","format":"uuid","title":"API Token ID","type":"string"}},"required":["api_token","api_token_id"],"title":"APITokenResult","type":"object"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"}}},"description":"Validation Error"}}}
>
  
</StatusCodes>
