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

# Generate customer_token

> Generate a new customer access_token (`customer_token`).

**Authentication**: `client_id` and `client_secret`

## Token handling

### Storage

`customer_token` is highly sensitive since it is needed to conduct many Finverse API operations (including retrieving other sensitive tokens).

**Best practices:**

\* Securely store the token in your back-end  
\* Never disclose this token externally (e.g. in your front-end).

### Renewal

`customer_token` expires after 1 hour.

Repeat this request for token renewal.



## OpenAPI

````yaml /api-reference/openapi.json post /auth/customer/token
openapi: 3.0.0
info:
  description: Documentation of the early finverse services
  title: Finverse Public
  termsOfService: https://example.com
  contact:
    name: Maintainers
    email: info@finverse.com
  license:
    name: unknown license
  version: 0.0.1
servers:
  - url: https://api.prod.finverse.net
security:
  - Oauth2:
      - test
tags:
  - name: public
    description: Publicly accessible endpoints
    x-group: Public
  - name: customer
    description: Customer app and institution endpoints
    x-group: Customer
  - name: link
    description: Finverse Link flows
    x-group: Link
  - name: login_identity
    description: Login identity lifecycle and metadata
    x-group: Login identity
  - name: accounts
    description: Accounts, balances, and account numbers
    x-group: Accounts
  - name: statements
    description: Statements and composite statements
    x-group: Statements
  - name: transactions
    description: Transaction history
    x-group: Transactions
  - name: identity_income
    description: Identity and income insights
    x-group: Identity & income
  - name: payment_links
    description: Payment link creation and checkout
    x-group: Payment links
  - name: mandates
    description: Direct debit mandates
    x-group: Mandates
  - name: payments
    description: Payment initiation and status
    x-group: Payment operations
  - name: payouts
    description: Payouts and scheduled payouts
    x-group: Payouts
  - name: payment_users
    description: Payment user profiles
    x-group: Payment users
  - name: payment_accounts
    description: Payment accounts for users
    x-group: Payment accounts
  - name: payment_methods
    description: Stored payment methods
    x-group: Payment methods
  - name: bills
    description: Bill presentment
    x-group: Bills
  - name: disputes
    description: Payment disputes
    x-group: Disputes
  - name: ledger
    description: Ledger and statements
    x-group: Ledger
paths:
  /auth/customer/token:
    post:
      tags:
        - public
      summary: Generate customer_token
      description: >-
        Generate a new customer access_token (`customer_token`).


        **Authentication**: `client_id` and `client_secret`


        ## Token handling


        ### Storage


        `customer_token` is highly sensitive since it is needed to conduct many
        Finverse API operations (including retrieving other sensitive tokens).


        **Best practices:**


        \* Securely store the token in your back-end  

        \* Never disclose this token externally (e.g. in your front-end).


        ### Renewal


        `customer_token` expires after 1 hour.


        Repeat this request for token renewal.
      operationId: generateCustomerAccessToken
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TokenRequest'
        description: token request
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenResponse'
              examples:
                success:
                  summary: Success
                  value:
                    access_token: '{customer_token}'
                    expires_in: 3600
                    issued_at: '2022-08-01T01:01:00.000Z'
                    token_type: Bearer
        '400':
          description: Invalid Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestModelV2'
              examples:
                invalid_parameter:
                  summary: Error (invalid parameter)
                  value:
                    code: 604
                    error:
                      code: INVALID_PARAMETER
                      details: client_id in body should be at least 26 chars long
                      error_code: INVALID_PARAMETER
                      message: The parameters provided are invalid. See details.
                      request_id: '{unique_id}'
                      type: API_ERROR
                    message: client_id in body should be at least 26 chars long
                unsupported_grant_type:
                  summary: Error (unsupported grant_type)
                  value:
                    error:
                      code: 40002
                      error_code: UNSUPPORTED_GRANT_TYPE
                      message: >-
                        Unsupported grant_type. Please review allowed parameter
                        values in API documentation.
                      request_id: '{unique_id}'
                      type: API_ERROR
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestModelV2'
              examples:
                invalid_credentials:
                  summary: Error (invalid credentials)
                  value:
                    error:
                      code: 40003
                      error_code: INVALID_CLIENT
                      message: >-
                        Client authentication failed. Please verify client_id
                        and client_secret inputs.
                      request_id: '{unique_id}'
                      type: API_ERROR
        '404':
          description: Error (path not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrBodyModelV2'
              examples:
                path_not_found:
                  summary: Error (path not found)
                  value:
                    code: 404
                    error:
                      code: PATH_NOT_FOUND
                      details: path /auth/customer/token2 was not found
                      error_code: PATH_NOT_FOUND
                      message: The provided path was not found
                      request_id: '{unique_id}'
                      type: API_ERROR
                    message: path /auth/customer/token2 was not found
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestModelV2'
      security: []
components:
  schemas:
    TokenRequest:
      required:
        - client_id
        - client_secret
        - grant_type
      properties:
        client_id:
          type: string
          maxLength: 26
          minLength: 26
          description: >-
            API credentials. These are managed on Finverse developer dashboard
            ([dashboard.finverse.com](https://dashboard.finverse.com))
        client_secret:
          type: string
          maxLength: 80
          minLength: 64
          description: API credentials
        grant_type:
          description: 'Accepted values: `grant_type`'
          type: string
          maxLength: 100
    TokenResponse:
      required:
        - access_token
        - token_type
        - expires_in
        - issued_at
      properties:
        access_token:
          type: string
          description: >-
            **(SENSITIVE)** Customer access token (referred to as
            `customer_token`)
        expires_in:
          description: Token validity length (in seconds)
          type: integer
          format: int64
        issued_at:
          type: string
          format: date-time
          description: Token issue time
        token_type:
          type: string
          description: 'Possible values: `Bearer`'
    BadRequestModelV2:
      properties:
        error:
          type: object
          required:
            - type
            - code
            - error_code
            - message
            - request_id
          properties:
            code:
              type: integer
              example: 40004
            details:
              type: string
            error_code:
              type: string
              example: CREDENTIALS_INVALID
            message:
              type: string
            request_id:
              description: The request_id provided in the request header
              type: string
            type:
              description: The error type
              type: string
              enum:
                - LINK_ERROR
                - API_ERROR
              example: LINKING_ERROR
    ErrBodyModelV2:
      properties:
        error:
          $ref: '#/components/schemas/FvErrorModelV2'
    FvErrorModelV2:
      required:
        - type
        - error_code
        - message
        - details
        - request_id
      properties:
        details:
          type: string
        error_code:
          type: string
          example: CREDENTIALS_INVALID
        message:
          type: string
        request_id:
          description: The request_id provided in the request header
          type: string
        type:
          description: The error type
          type: string
          enum:
            - LINK_ERROR
            - API_ERROR
          example: LINKING_ERROR
  securitySchemes:
    Oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://finverse-dev.us.auth0.com/oauth/token
          scopes:
            account: Account
            balance: Balance
            credit: Credit
            institution: Institution
            investment: Investment
            link: Link
            test: Test
            transaction: Transaction

````