> ## Documentation Index
> Fetch the complete documentation index at: https://api-reference.hyperswitch.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication - Create

> Create a new authentication for accessing our APIs from your servers.




## OpenAPI

````yaml post /authentication
openapi: 3.0.3
info:
  title: Hyperswitch - API Documentation
  description: >

    ## Get started


    Hyperswitch provides a collection of APIs that enable you to process and
    manage payments.

    Our APIs accept and return JSON in the HTTP body, and return standard HTTP
    response codes.


    You can consume the APIs directly using your favorite HTTP/REST library.


    We have a testing environment referred to "sandbox", which you can setup to
    test API calls without

    affecting production data.

    Currently, our sandbox environment is live while our production environment
    is under development

    and will be available soon.

    You can sign up on our Dashboard to get API keys to access Hyperswitch API.


    ### Environment


    Use the following base URLs when making requests to the APIs:


    | Environment   |  Base URL                          |

    |---------------|------------------------------------|

    | Sandbox       | <https://sandbox.hyperswitch.io>   |

    | Production    | <https://api.hyperswitch.io>       |


    ## Authentication


    When you sign up on our [dashboard](https://app.hyperswitch.io) and create a
    merchant

    account, you are given a secret key (also referred as api-key) and a
    publishable key.

    You may authenticate all API requests with Hyperswitch server by providing
    the appropriate key in

    the request Authorization header.


    | Key             | 
    Description                                                                                 
    |

    |-----------------|-----------------------------------------------------------------------------------------------|

    | api-key         | Private key. Used to authenticate all API requests from
    your merchant server                  |

    | publishable key | Unique identifier for your account. Used to authenticate
    API requests from your app's client  |


    Never share your secret api keys. Keep them guarded and secure.
  contact:
    name: Hyperswitch Support
    url: https://hyperswitch.io
    email: support.global@juspay.io
  license:
    name: Apache-2.0
  version: 0.1.0
servers:
  - url: https://sandbox.hyperswitch.io
    description: Sandbox Environment
security: []
tags:
  - name: Merchant Account
    description: Create and manage merchant accounts
  - name: Profile
    description: Create and manage profiles
  - name: Merchant Connector Account
    description: Create and manage merchant connector accounts
  - name: Payments
    description: Create and manage one-time payments, recurring payments and mandates
  - name: Refunds
    description: Create and manage refunds for successful payments
  - name: Mandates
    description: Manage mandates
  - name: Customers
    description: Create and manage customers
  - name: Payment Methods
    description: Create and manage payment methods of customers
  - name: Disputes
    description: Manage disputes
  - name: API Key
    description: Create and manage API Keys
  - name: Payouts
    description: Create and manage payouts
  - name: payment link
    description: Create payment link
  - name: Routing
    description: Create and manage routing configurations
  - name: Event
    description: Manage events
  - name: Authentication
    description: Create and manage authentication
  - name: Subscriptions
    description: Subscription management and billing endpoints
  - name: Card Issuer
    description: Create and manage card issuers
paths:
  /authentication:
    post:
      tags:
        - Authentication
      summary: Authentication - Create
      description: |
        Create a new authentication for accessing our APIs from your servers.
      operationId: Create an Authentication
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthenticationCreateRequest'
        required: true
      responses:
        '200':
          description: Authentication created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthenticationResponse'
        '400':
          description: Invalid data
      security:
        - api_key: []
components:
  schemas:
    AuthenticationCreateRequest:
      type: object
      required:
        - amount
        - currency
      properties:
        authentication_id:
          type: string
          description: The unique identifier for this authentication.
          example: auth_mbabizu24mvu3mela5njyhpit4
          nullable: true
        profile_id:
          type: string
          description: The business profile that is associated with this authentication
          nullable: true
        amount:
          $ref: '#/components/schemas/MinorUnit'
        authentication_connector:
          allOf:
            - $ref: '#/components/schemas/AuthenticationConnectors'
          nullable: true
        currency:
          $ref: '#/components/schemas/Currency'
        return_url:
          type: string
          description: The URL to which the user should be redirected after authentication.
          example: https://example.com/redirect
          nullable: true
        force_3ds_challenge:
          type: boolean
          description: Force 3DS challenge.
          nullable: true
        psd2_sca_exemption_type:
          allOf:
            - $ref: '#/components/schemas/ScaExemptionType'
          nullable: true
        profile_acquirer_id:
          type: string
          description: Profile Acquirer ID get from profile acquirer configuration
          nullable: true
        acquirer_details:
          allOf:
            - $ref: '#/components/schemas/AcquirerDetails'
          nullable: true
        customer_details:
          allOf:
            - $ref: '#/components/schemas/CustomerDetails'
          nullable: true
    AuthenticationResponse:
      type: object
      required:
        - authentication_id
        - merchant_id
        - status
        - amount
        - currency
      properties:
        authentication_id:
          type: string
          description: The unique identifier for this authentication.
          example: auth_mbabizu24mvu3mela5njyhpit4
        merchant_id:
          type: string
          description: >-
            This is an identifier for the merchant account. This is inferred
            from the API key

            provided during the request
          example: merchant_abc
        status:
          $ref: '#/components/schemas/AuthenticationStatus'
        client_secret:
          type: string
          description: >-
            The client secret for this authentication, to be used for
            client-side operations.
          example: auth_mbabizu24mvu3mela5njyhpit4_secret_el9ksDkiB8hi6j9N78yo
          nullable: true
        amount:
          $ref: '#/components/schemas/MinorUnit'
        currency:
          $ref: '#/components/schemas/Currency'
        authentication_connector:
          allOf:
            - $ref: '#/components/schemas/AuthenticationConnectors'
          nullable: true
        force_3ds_challenge:
          type: boolean
          description: Whether 3DS challenge was forced.
          nullable: true
        return_url:
          type: string
          description: >-
            The URL to which the user should be redirected after authentication,
            if provided.
          nullable: true
        created_at:
          type: string
          format: date-time
          example: '2022-09-10T10:11:12Z'
          nullable: true
        error_code:
          type: string
          example: E0001
          nullable: true
        error_message:
          type: string
          description: >-
            If there was an error while calling the connector the error message
            is received here
          example: Failed while verifying the card
          nullable: true
        profile_id:
          type: string
          description: The business profile that is associated with this payment
          nullable: true
        psd2_sca_exemption_type:
          allOf:
            - $ref: '#/components/schemas/ScaExemptionType'
          nullable: true
        acquirer_details:
          allOf:
            - $ref: '#/components/schemas/AcquirerDetails'
          nullable: true
        profile_acquirer_id:
          type: string
          description: Profile Acquirer ID get from profile acquirer configuration
          nullable: true
        customer_details:
          allOf:
            - $ref: '#/components/schemas/CustomerDetails'
          nullable: true
    MinorUnit:
      type: integer
      format: int64
      description: This Unit struct represents MinorUnit in which core amount works
    AuthenticationConnectors:
      type: string
      enum:
        - threedsecureio
        - netcetera
        - gpayments
        - ctp_mastercard
        - unified_authentication_service
        - juspaythreedsserver
        - ctp_visa
        - cardinal
    Currency:
      type: string
      description: >-
        The three-letter ISO 4217 currency code (e.g., "USD", "EUR") for the
        payment amount. This field is mandatory for creating a payment.
      enum:
        - AED
        - AFN
        - ALL
        - AMD
        - ANG
        - AOA
        - ARS
        - AUD
        - AWG
        - AZN
        - BAM
        - BBD
        - BDT
        - BGN
        - BHD
        - BIF
        - BMD
        - BND
        - BOB
        - BRL
        - BSD
        - BTN
        - BWP
        - BYN
        - BZD
        - CAD
        - CDF
        - CHF
        - CLF
        - CLP
        - CNY
        - COP
        - CRC
        - CUC
        - CUP
        - CVE
        - CZK
        - DJF
        - DKK
        - DOP
        - DZD
        - EGP
        - ERN
        - ETB
        - EUR
        - FJD
        - FKP
        - GBP
        - GEL
        - GHS
        - GIP
        - GMD
        - GNF
        - GTQ
        - GYD
        - HKD
        - HNL
        - HRK
        - HTG
        - HUF
        - IDR
        - ILS
        - INR
        - IQD
        - IRR
        - ISK
        - JMD
        - JOD
        - JPY
        - KES
        - KGS
        - KHR
        - KMF
        - KPW
        - KRW
        - KWD
        - KYD
        - KZT
        - LAK
        - LBP
        - LKR
        - LRD
        - LSL
        - LYD
        - MAD
        - MDL
        - MGA
        - MKD
        - MMK
        - MNT
        - MOP
        - MRU
        - MUR
        - MVR
        - MWK
        - MXN
        - MYR
        - MZN
        - NAD
        - NGN
        - NIO
        - NOK
        - NPR
        - NZD
        - OMR
        - PAB
        - PEN
        - PGK
        - PHP
        - PKR
        - PLN
        - PYG
        - QAR
        - RON
        - RSD
        - RUB
        - RWF
        - SAR
        - SBD
        - SCR
        - SDG
        - SEK
        - SGD
        - SHP
        - SLE
        - SLL
        - SOS
        - SRD
        - SSP
        - STD
        - STN
        - SVC
        - SYP
        - SZL
        - THB
        - TJS
        - TMT
        - TND
        - TOP
        - TRY
        - TTD
        - TWD
        - TZS
        - UAH
        - UGX
        - USD
        - UYU
        - UZS
        - VES
        - VND
        - VUV
        - WST
        - XAF
        - XCD
        - XOF
        - XPF
        - YER
        - ZAR
        - ZMW
        - ZWL
    ScaExemptionType:
      type: string
      description: SCA Exemptions types available for authentication
      enum:
        - low_value
        - transaction_risk_analysis
    AcquirerDetails:
      type: object
      properties:
        acquirer_bin:
          type: string
          description: The bin of the card.
          example: '123456'
          nullable: true
        acquirer_merchant_id:
          type: string
          description: The merchant id of the card.
          example: merchant_abc
          nullable: true
        merchant_country_code:
          type: string
          description: The country code of the card.
          example: US/34456
          nullable: true
    CustomerDetails:
      type: object
      description: >-
        Passing this object creates a new customer or attaches an existing
        customer to the payment
      properties:
        id:
          type: string
          description: The identifier for the customer.
          example: cus_y3oqhf46pyzuxjbcn2giaqnb44
          nullable: true
          maxLength: 64
          minLength: 1
        name:
          type: string
          description: The customer's name
          example: John Doe
          nullable: true
          maxLength: 255
        email:
          type: string
          description: The customer's email address
          example: johntest@test.com
          nullable: true
          maxLength: 255
        phone:
          type: string
          description: The customer's phone number
          example: '9123456789'
          nullable: true
          maxLength: 10
        phone_country_code:
          type: string
          description: The country code for the customer's phone number
          example: '+1'
          nullable: true
          maxLength: 2
        tax_registration_id:
          type: string
          description: The tax registration identifier of the customer.
          nullable: true
          maxLength: 255
        document_details:
          allOf:
            - $ref: '#/components/schemas/CustomerDocumentDetails'
          nullable: true
    AuthenticationStatus:
      type: string
      enum:
        - started
        - pending
        - success
        - failed
    CustomerDocumentDetails:
      type: object
      required:
        - document_type
        - document_number
      properties:
        document_type:
          $ref: '#/components/schemas/DocumentKind'
        document_number:
          type: string
          description: |-
            The customer's document number
            Length of the document number depends upon the document_type.
            For CPF/CNPJ it is typically 11/14 digits long
          example: '12345678911'
          maxLength: 255
    DocumentKind:
      type: string
      description: Represents the type of identification document used for validation.
      enum:
        - cpf
        - cnpj
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: api-key
      description: >-
        Use the API key created under your merchant account from the HyperSwitch
        dashboard. API key is used to authenticate API requests from your
        merchant server only. Don't expose this key on a website or embed it in
        a mobile application.

````