# Create a new access token

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /access_tokens:
    post:
      summary: Create a new access token
      deprecated: false
      description: >+
        This action lets you use a long‑lived Login token to obtain a
        short‑lived Access token, which you can then use to access other
        resources. The Access token is a
        [JWT](https://en.wikipedia.org/wiki/JSON_Web_Token) that you can inspect
        to verify its permissions and validity.


        For Access tokens, the validity is limited to 5 minutes.


        In addition to standard claims, each token includes an `exp` claim that
        contains a `NumericDate` (a Unix timestamp in whole seconds, UTC, since
        `1970‑01‑01T00:00:00Z`). The token is rejected once the current time is
        at or past `exp`. When it expires, you must acquire a new Access token.


        At the same time, an Access token has an `scp` claim where permissions
        are stored.


        > Permissions for an Access token are inherited from the Login token
        used to create it

      operationId: Create a new access token
      tags:
        - Access tokens
        - Access tokens
      parameters:
        - name: Accept
          in: header
          description: e.g. application/vnd.api+json
          required: true
          example: application/vnd.api+json
          schema:
            type: string
        - name: Content-Type
          in: header
          description: ''
          required: true
          example: application/vnd.api+json
          schema:
            type: string
      requestBody:
        content:
          application/vnd.api+json:
            schema:
              properties:
                data:
                  properties:
                    attributes:
                      properties:
                        customer_uuid:
                          type: string
                        login_token:
                          type: string
                      type: object
                      x-apidog-orders:
                        - customer_uuid
                        - login_token
                    type:
                      type: string
                  type: object
                  x-apidog-orders:
                    - attributes
                    - type
                  required:
                    - attributes
                    - type
              type: object
              x-apidog-orders:
                - data
              examples:
                - data:
                    attributes:
                      customer_uuid: 9796513c-e811-4b75-b2eb-b36b9f1a1b8c
                      login_token: >-
                        5d16cbf4794439be3139a2009edc8cc06911802102214b5fce8320ff4edb61ae
                    type: login_tokens
              required:
                - data
            examples: {}
      responses:
        '201':
          description: Created
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      attributes:
                        type: object
                        properties:
                          encoded:
                            type: string
                        required:
                          - encoded
                        x-apidog-orders:
                          - encoded
                      id:
                        type: string
                      type:
                        type: string
                    required:
                      - attributes
                      - id
                      - type
                    x-apidog-orders:
                      - attributes
                      - id
                      - type
                required:
                  - data
                x-apidog-orders:
                  - data
              example:
                data:
                  attributes:
                    encoded: >-
                      eyJhbGciOiJFUzI1NiJ9.eyJzY3AiOlsiZW50aXR5X2NvbnN1bXB0aW9ucyJdLCJqaXQiOiJjMGY2ODdhYzZiNDdjM2FiIiwibHRpIjo4LCJzdWIiOiI1MTIzZDhlZi1iNTAxLTRjNzEtYjE4OC04M2FjMzk5ZDY2YjkiLCJleHAiOjE1NzQ3NzU5NjgsImtleSI6MX0.jbRqzsRS78yEuLO5advtgjlYgEbL4UckDoErj2Wc2SjM-pjr1MGUvb2uZkCcIxAmkLfy99pjNW8OT2t9snL6xw
                  id: c0f687ac6b47c3ab
                  type: access_tokens
          headers: {}
          x-apidog-name: Created
        '400':
          description: Bad Request
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        detail:
                          type: string
                        status:
                          type: string
                        title:
                          type: string
                      x-apidog-orders:
                        - detail
                        - status
                        - title
                      required:
                        - title
                        - status
                        - detail
                required:
                  - errors
                x-apidog-orders:
                  - errors
              example:
                errors:
                  - detail: Customer UUID is not a valid value
                    status: '400'
                    title: Bad Request
          headers: {}
          x-apidog-name: Bad Request
        '406':
          description: Not Acceptable
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        detail:
                          type: string
                        status:
                          type: string
                        title:
                          type: string
                      x-apidog-orders:
                        - detail
                        - status
                        - title
                      required:
                        - title
                        - status
                        - detail
                required:
                  - errors
                x-apidog-orders:
                  - errors
              example:
                errors:
                  - detail: >-
                      Unsupported Accept header value in the request. The
                      endpoint expects the request to include header `Accept:
                      application/vnd.api+json`
                    status: '406'
                    title: Not Acceptable
          headers: {}
          x-apidog-name: Not Acceptable
        '415':
          description: Unsupported Media Type
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        detail:
                          type: string
                        status:
                          type: string
                        title:
                          type: string
                      x-apidog-orders:
                        - detail
                        - status
                        - title
                      required:
                        - title
                        - status
                        - detail
                required:
                  - errors
                x-apidog-orders:
                  - errors
              example:
                errors:
                  - detail: >-
                      Unsupported Content-Type header value in the request. The
                      endpoint expects the request to include header
                      `Content-Type: application/vnd.api+json`
                    status: '415'
                    title: Unsupported Media Type
          headers: {}
          x-apidog-name: Unsupported Media Type
        '429':
          description: Too Many Requests
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                        title:
                          type: string
                      x-apidog-orders:
                        - status
                        - title
                      required:
                        - status
                        - title
                required:
                  - errors
                x-apidog-orders:
                  - errors
              example:
                errors:
                  - status: '429'
                    title: Too Many Requests
          headers: {}
          x-apidog-name: Too Many Requests
        '500':
          description: Internal Server Error
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        detail:
                          type: string
                        status:
                          type: string
                        title:
                          type: string
                      x-apidog-orders:
                        - detail
                        - status
                        - title
                      required:
                        - title
                        - status
                        - detail
                required:
                  - errors
                x-apidog-orders:
                  - errors
              example:
                errors:
                  - detail: Something went wrong
                    status: '500'
                    title: Internal Server Error
          headers: {}
          x-apidog-name: Server Error
      security: []
      x-apidog-folder: Access tokens
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/1003855/apis/api-19188091-run
components:
  schemas: {}
  securitySchemes:
    Access token:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
      x-apidog:
        addTokenTo: header
        headerPrefix: Bearer
    Import token:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
      x-apidog:
        addTokenTo: header
        headerPrefix: Bearer
    Login token:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
      x-apidog:
        addTokenTo: header
        headerPrefix: Bearer
    Access  or  Import token:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
      x-apidog:
        addTokenTo: header
        headerPrefix: Bearer
servers:
  - url: https://api.enectiva.cz
    description: https://api.enectiva.cz
security: []

```
