---
agentTools:
  projectIndex: https://tyms.readme.io/llms.txt
---

# Generate Access Token

Here, you find the endpoint you need to generate access token for the business.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Tyms (Sandbox)",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://staging-api.tyms.io/api/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "name": "secret-key",
        "in": "header",
        "x-default": "sk_2938310299229"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/oauth/access/token": {
      "post": {
        "summary": "Generate Access Token",
        "description": "Here, you find the endpoint you need to generate access token for the business.",
        "operationId": "get-access-token",
        "parameters": [
          {
            "name": "secret-key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "authorization_code",
                  "business_id"
                ],
                "properties": {
                  "authorization_code": {
                    "type": "string",
                    "description": "This is the code to be exchanged for access token and it's only valid for ten  minutes. This code is added to the GET parameter when user is redirected to your redirect uri after authorizing your application"
                  },
                  "business_id": {
                    "type": "string",
                    "description": "The business the user is authorising for your application. In the case where tokens are restricted to a single business, (when a user is shown a dropdown of business choices, the id of the business that you are recommending the user auth against."
                  }
                }
              },
              "examples": {
                "Request Example": {
                  "value": {
                    "status": "success",
                    "message": "Business access token retrieved successfully",
                    "data": {
                      "access_token": "iMHl867mSkqiE5blOqCazypT4Rjiys4WOtt4qMkm",
                      "expires_at": "2023-06-18T00:19:15.488871Z",
                      "refresh_token": "jAXr1aYQXsVi6fr61doLx3EZVsR3nsT9rV8N2nXx"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"status\": \"success\",\n    \"message\": \"Business access token retrieved successfully\",\n    \"data\": {\n        \"access_token\": \"iMHl867mSkqiE5blOqCazypT4Rjiys4WOtt4qMkm\",\n        \"expires_at\": \"2023-10-05T00:19:15.488871Z\",\n        \"refresh_token\": \"jAXr1aYQXsVi6fr61doLx3EZVsR3nsT9rV8N2nXx\"\n    }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "success"
                    },
                    "message": {
                      "type": "string",
                      "example": "Business access token retrieved successfully"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "access_token": {
                          "type": "string",
                          "example": "iMHl867mSkqiE5blOqCazypT4Rjiys4WOtt4qMkm"
                        },
                        "expires_at": {
                          "type": "string",
                          "example": "2023-10-05T00:19:15.488871Z"
                        },
                        "refresh_token": {
                          "type": "string",
                          "example": "jAXr1aYQXsVi6fr61doLx3EZVsR3nsT9rV8N2nXx"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "66af161f6f18be002a6dc48f:651d4a77c8162c002fcb9172"
}
```