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

# Create Token

> Authenticates a partner using their API key.

### Request Body

- **api_key** (`string`, required): Your unique API key provided by TakeProfit.
    

### Response

- **status**:
    
    - **code** (`integer`): Status code (`0` indicates success).
        
    - **message** (`string`): Status message.
        
    - **details** (`array`): Additional details.
        
- **access_token**:
    
    - **token** (`string`): JWT access token.
        
    - **valid_to_time** (`string`): Expiration time of the access token in ISO 8601 format.
        
- **refresh_token**:
    
    - **token** (`string`): JWT refresh token.
        
    - **valid_to_time** (`string`): Expiration time of the refresh token in ISO 8601 format.



## OpenAPI

````yaml post /takeprofit.partner.external.auth.v1.AuthApi.Login
openapi: 3.0.0
info:
  title: TakeProfit Partner API
  description: TakeProfit Partner API documentation
  version: 0.1-beta
servers:
  - url: https://api.dev.tpinf.in
    description: Development environment
  - url: https://api.takeprofit.com
    description: '''Production environment'''
security: []
tags:
  - name: Partner API
  - name: Credentials
    description: >-
      The Credentials API allows partners to authenticate and obtain access
      tokens required for accessing other secured endpoints. This documentation
      provides details on how to use the authentication endpoints, including
      request and response formats.


      ## Overview


      The Authentication API provides two primary endpoints:


      1. **Create Token**: Authenticates a partner using their API key and
      returns an access token and a refresh token.
          
      2. **Refresh Token**: Generates a new access token using a valid refresh
      token.
  - name: Link
    description: >-
      The Link API allows partners to manage the linkage between their own
      securities and the securities provided by TakeProfit. This includes
      creating, retrieving, and deleting links between securities.
  - name: Reference API
    description: Set of APIs to get reference info such as exchanges, securities.
  - name: Marketdata API
    description: Set of APIs to get marketdata such as historical candles
  - name: Widgets
    description: |-
      Describe how to use TakeProfit Backend API from Widgets.

      Each request to API must has 'accesstoken' header with valid JWT-token.

      Describe here how to obtain JWT for widget.
paths:
  /takeprofit.partner.external.auth.v1.AuthApi.Login:
    post:
      tags:
        - Credentials
      summary: Create Token
      description: >-
        Authenticates a partner using their API key.


        ### Request Body


        - **api_key** (`string`, required): Your unique API key provided by
        TakeProfit.
            

        ### Response


        - **status**:
            
            - **code** (`integer`): Status code (`0` indicates success).
                
            - **message** (`string`): Status message.
                
            - **details** (`array`): Additional details.
                
        - **access_token**:
            
            - **token** (`string`): JWT access token.
                
            - **valid_to_time** (`string`): Expiration time of the access token in ISO 8601 format.
                
        - **refresh_token**:
            
            - **token** (`string`): JWT refresh token.
                
            - **valid_to_time** (`string`): Expiration time of the refresh token in ISO 8601 format.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                api_key: YOUR_API_KEY_HERE
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
              examples:
                example-0:
                  summary: Success
                  value:
                    status:
                      code: 0
                      message: ''
                      details: []
                    access_token:
                      token: VALID_ACCESS_TOKEN
                      valid_to_time: '2024-10-30T12:57:25Z'
                    refresh_token:
                      token: VALID_REFRESH_TOKEN
                      valid_to_time: '2024-10-30T14:27:25Z'
                example-1:
                  summary: Unsuccessful
                  value:
                    status:
                      code: 7
                      message: Invalid api_key
                      details: []

````