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

# Getting an access token

To obtain your access token before requesting any other API endpoint, you need two parameters.

[block:api-header]
{
  "type": "basic",
  "title": "grant_type"
}
[/block]

**Type:** Query String

This parameter specifies the OAuth2 grant type you would like obtain your access token with. We currently support only client\_credentials type of grant, but we may add new grant types in the future. For any requests just contact us at <info@motaword.com>.

The default and only value is "client\_credentials".

[block:api-header]
{
  "type": "basic",
  "title": "Authorization"
}
[/block]

**Type:** Header parameter

This parameter is the HTTP Basic Authentication header. [Here](http://en.wikipedia.org/wiki/Basic_access_authentication) is the Wikipedia page to save you some trouble. :)

Basically, this header parameter is constructed by encoding your application ID and application secret key with base64. Here is an example for the value of this parameter:

**You combine your application ID and secret key with a colon between them:**

```
MyFirstAppID:MyFirstAppSecret
```

**Then you encode this with base64:**

```
TXlGaXJzdEFwcElEOk15Rmlyc3RBcHBTZWNyZXQ=
```

**Final header adds the static word "Basic" and must read like this:**

```
Authorization: Basic TXlGaXJzdEFwcElEOk15Rmlyc3RBcHBTZWNyZXQ=
```

[block:callout]
{
  "type": "warning",
  "body": "The API explorer widget does not work well with authorization. We suggest using the [Authorization Tool](https://www.motaword.com/developer/tools) and then follow the link generated for you to experiment on this documentation.",
  "title": "Authorization Tool"
}
[/block]

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "API Settings",
    "version": "1.5.2"
  },
  "servers": [
    {
      "url": "https://api.motaword.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "name": "access_token",
        "in": "query",
        "x-default": ""
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/token": {
      "post": {
        "summary": "Getting an access token",
        "description": "",
        "operationId": "token",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "grant_type",
                  "Authorization"
                ],
                "properties": {
                  "grant_type": {
                    "type": "string",
                    "description": "\"client_credentials\" is the only acceptable value for now. In the future, we may provide other grant types, so you must specify this grant type even though it is the only available one.",
                    "default": "client_credentials"
                  },
                  "Authorization": {
                    "type": "string",
                    "description": "This is the \"HTTP Basic Authorization\" HEADER. See below for details.",
                    "default": "Basic ***"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"access_token\": \"string\",\n  \"expires_in\": integer,\n  \"token_type\": \"string\",\n  \"scope\": \"string\"\n}"
                  }
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"error\": {\n        \"code\": \"InvalidCredentials\",\n        \"http_code\": 401,\n        \"message\": \"Your credentials are wrong.\",\n        \"help\": \"https://developer.motaword.com/support\"\n    }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "example": "InvalidCredentials"
                        },
                        "http_code": {
                          "type": "integer",
                          "example": 401,
                          "default": 0
                        },
                        "message": {
                          "type": "string",
                          "example": "Your credentials are wrong."
                        },
                        "help": {
                          "type": "string",
                          "example": "https://developer.motaword.com/support"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "security": []
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "6305402c9807941f67a92eb7:55122b890c1a08190077f975"
}
```