---
title: "Get Access Token"
method: POST
path: "/v1/auth/tokens"
tags: ["Authorization"]
---

# Get Access Token

`POST /v1/auth/tokens`

CoreStack requires Auth token to be passed in all the API headers. Auth token has to be generated and it is valid only for an hour. New token can be generated using this API. Extract Auth-token, Tenant Id & Account Id from the response. This will be required in most of the API calls

## Request body

- AuthRequest
  - `access_key` string — API Access Key. This can be retrieved from the <b>My Profile</b> page. Also this will be sent over email when the keys are generated.Please enter username and password pair or access_key and secret_key pair
  - `secret_key` string — API Secret Key. This will be available in the email sent when the keys are generated. If you have lost the secret key, it cannot be retrieved. Request your admin to generate a new set of keys, if lost.Please enter username and password pair or access_key and secret_key pair
  - `username` string — User name which will be used to login to corestack.Please enter username and password pair or access_key and secret_key pair
  - `password` string — Password which will be used to login to corestack.Please enter username and password pair or access_key and secret_key pair

## Response `201`

Created

- AuthResponse
  - `token` Authorization, required
    - `issued_at` string, required — DateTime in UTC when the token was issued.
    - `expires_at` string, required — Token expiry datetime in UTC.
    - `access_token` string, required — This will be used as X-Auth-Token in all other APIs.
  - `header_logo` string, required — Header logo.
  - `banner_logo` string, required — Banner logo.
  - `user` UserModel, required
    - `name` string, required — Name of the user.
    - `id` string, required — Id of the user. This will be used for performing user level operations such as getUser, changePassword and so on.
    - `email` string, required — Email Id of the user. This wil be unique.
    - `active_tenant_id` string, required — Active tenant id.
    - `timezone` TimezoneModel, required
      - `id` string, required — Id of the Timezone such as Asia/Kolkata, Asia/Dubai and so on.
      - `raw_offset` string, required — Raw offset of the timezone. It means the amount of time in milliseconds to add to UTC to get standard time in the required time zone.
    - `preferred_language` 'en' | 'ja' — Preferred language of the user.
    - `mcp_server_enabled` boolean, required — Checks if the account is mcp server enabled or not
    - `mfa_enabled` string, required — Checks if the account is mfa enabled or not
    - `master_account_id` string, required — Master Account ID of the user.
    - `master_account_name` string, required — Master Account Name of the user.
    - `products` string[] — Products enabled in the master account
    - `crm_id` string — Customer Relationship Management ID
    - `master_account_ids` string[] — list of master account ids
  - `account_id` string, required — Id of the Account in CoreStack. There can be multiple tenats within an account, so account_id will be required for performing account level actions such as createTenant.
  - `is_account_admin` boolean, required — Implies the user associated with Access Key / Secret Key is an account admin in CoreStack. True means account admin.
  - `tenants` TokenTenantModel[], required — List of tenants within the CoreStack account. Each tenant will have an id & name that uniquely identifies it.
    - `id` string — Id of the tenant. This will be used for performing tenant level operations such as createPolicy, createScript, onboardCloudAccount and so on.
    - `name` string — Unique name of the tenant provided as input when creating.
    - `master_tenant` boolean — If user created under particular tenant it will be set to True or else False
    - `roles` object — Roles
  - `audit` AuditModel
    - `enabled` boolean — Whether audit log is enabled or not.
    - `audit_level` string — Audit log level.
  - `user_guide_url` string — User Guide URL
  - `support_url` string — Support URL
  - `terms_and_conditions_url` string — Terms and Conditions URL

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `500` — Internal Server Error

---

[API](https://skmtc.dev/corestack/apis/corestack-external-api.md) · [All operations](https://skmtc.dev/corestack/apis/corestack-external-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/corestack/corestack-external-api/revisions/bf2cdf20826d/schema)
