> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sezzle.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Obtain Authentication Token

> Generate authentication token from your Sezzle merchant API keys for use in the header of all other API requests.

<Danger>
  You are viewing Version 1 of the Sezzle API. Check out the [current version](/docs/api/intro)!
</Danger>


## OpenAPI

````yaml post /v1/authentication
openapi: 3.1.0
info:
  title: Sezzle API v2
  description: >-
    This Sezzle API is for merchants who want to accept Sezzle as a payment
    option
  termsOfService: https://legal.sezzle.com
  version: 2.0.0
  x-logo:
    url: https://media.sezzle.com/branding/2.0/png/Logo_WhiteWordmark_500x126.png
    backgroundColor: '#392558'
servers:
  - url: https://sandbox.gateway.sezzle.com
    description: development server, usa, ca
  - url: https://gateway.sezzle.com
    description: production server, usa, ca
security:
  - Bearer: []
externalDocs:
  description: Sezzle API guides and tutorials
  url: https://docs.sezzle.com/sezzle-integration
paths:
  /v1/authentication:
    post:
      tags:
        - v1
        - Authentication
      summary: Obtain Authentication Token
      description: >-
        Generate authentication token from your Sezzle merchant API keys for use
        in the header of all other API requests.
      operationId: post-authentication-v1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthenticationRequest'
            example:
              private_key: sz_pr_...
              public_key: sz_pub_...
      responses:
        '201':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthenticationResponse'
              example:
                expiration_date: '2017-01-01T01:30:25.388Z'
                merchant_uuid: merchant1234567890
                token: example-token
        '400':
          $ref: '#/components/responses/BadRequestV1'
          example:
            status: 400
            id: bad_request
            message: bad request
        '401':
          $ref: '#/components/responses/UnauthorizedV1'
          example:
            status: 401
            id: Unauthorized
            message: authorization not accepted
        '404':
          $ref: '#/components/responses/NotFoundV1'
          example:
            status: 404
            id: invalid
            message: not found
        '422':
          $ref: '#/components/responses/UnprocessableV1'
          example:
            status: 422
            id: invalid
            message: Unprocessable entity
components:
  schemas:
    AuthenticationRequest:
      type: object
      required:
        - private_key
        - public_key
      properties:
        public_key:
          type: string
          description: >-
            Find your API keys at
            https://dashboard.sezzle.com/merchant/settings/apikeys
        private_key:
          type: string
          description: >-
            Find your API keys at
            https://dashboard.sezzle.com/merchant/settings/apikeys
    AuthenticationResponse:
      type: object
      properties:
        token:
          type: string
          description: |
            - For use in the header of other requests:
            - Authorization: Bearer {response.token}
        expiration_date:
          type: string
          format: date-time
          description: >-
            You must replace the token you obtain from the Authentication
            endpoint every 120 minutes. However, we do not restrict you to a
            single token, and you can obtain a new one at any time.
        merchant_uuid:
          type: string
          description: The merchant UUID for the account
    ErrorV1:
      type: object
      properties:
        status:
          type: number
          description: Matches the HTTP Status code of the response
        id:
          type: string
          description: >-
            A programmatic identifier for the error. These rarely (if at all)
            change.
        message:
          type: string
          description: >-
            A human-friendly string. These may change, and are intended to
            assist in debugging rather than program logic.
  responses:
    BadRequestV1:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorV1'
          example:
            status: 400
            id: bad_request
            message: bad request
    UnauthorizedV1:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorV1'
          example:
            status: 401
            id: unauthorized
            message: authorization not accepted
    NotFoundV1:
      description: The specified resource was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorV1'
          example:
            status: 404
            id: record_not_found
            message: not found
    UnprocessableV1:
      description: Unable to process the request entity
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorV1'
          example:
            status: 422
            id: invalid
            message: Unprocessable entity
  securitySchemes:
    Bearer:
      type: apiKey
      name: Authorization
      in: header
      description: >-
        The authentication token generated from providing API Keys to Sezzle
        Gateway

````