> ## Documentation Index
> Fetch the complete documentation index at: https://vectorly-783efd43.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Code2Token Post

> Exchange code for access token.



## OpenAPI

````yaml post /base/code2token
openapi: 3.1.0
info:
  title: Coinfer Server API
  version: 0.0.1776236533+0db4b8c
  description: |+

    This part of document describes the HTTP APIs of the Coinfer cloud.

servers:
  - url: https://api.coinfer.ai
    description: The production environment
  - url: https://dev.coinfer.ai
    description: The development environment
security: []
tags:
  - name: Object
    description: APIs related to object CRUD operations.
  - name: Invoke
    description: APIs used to invoke CloudFunction or run workflow.
  - name: Notification
    description: APIs related to notification.
  - name: Authorization
    description: >-
      APIs related to user, token, login, etc.


      Normally APIs in this group should not be used. You should get API token
      from our website and then use the token to call other APIs.
paths:
  /base/code2token:
    post:
      tags:
        - Authorization
      summary: Code2Token Post
      description: Exchange code for access token.
      operationId: coinfer_apis_base_api_code2token_post
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Code2TokenReq'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccRsp_Code2TokenRsp_'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrRsp'
      security:
        - GlobalAuth: []
components:
  schemas:
    Code2TokenReq:
      properties:
        account_type:
          $ref: '#/components/schemas/SocialType'
          description: account type
        code:
          description: auth code
          title: Code
          type: string
        code_verifier:
          default: ''
          description: code verifier in auth code flow with PKCE
          title: Code Verifier
          type: string
        gh_installation_id:
          anyOf:
            - type: integer
            - type: 'null'
          description: github installation id
          title: Gh Installation Id
      required:
        - account_type
        - code
      title: Code2TokenReq
      type: object
    SuccRsp_Code2TokenRsp_:
      properties:
        status:
          const: ok
          title: Status
          type: string
        data:
          $ref: '#/components/schemas/Code2TokenRsp'
      required:
        - status
        - data
      title: SuccRsp[Code2TokenRsp]
      type: object
    ErrRsp:
      properties:
        status:
          const: error
          title: Status
          type: string
        code:
          title: Code
          type: string
        message:
          title: Message
          type: string
      required:
        - status
        - code
        - message
      title: ErrRsp
      type: object
    SocialType:
      enum:
        - google
        - microsoft
        - github
      title: SocialType
      type: string
    Code2TokenRsp:
      properties:
        access_token:
          anyOf:
            - type: string
            - type: 'null'
          title: Access Token
      required:
        - access_token
      title: Code2TokenRsp
      type: object
  securitySchemes:
    GlobalAuth:
      type: http
      scheme: bearer

````