# Retrieve an access token

MotaWord API is using OAuth2 procedures when authenticating or authorizing your API call.


# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "MotaWord API",
    "description": "Use MotaWord API to post and track your translation projects.",
    "version": "1.0",
    "x-cli-name": "motaword",
    "x-cli-description": "Use MotaWord CLI to interact with your MotaWord account in many ways to manage your translation and localization needs. Visit motaword.com/developer for details."
  },
  "security": [
    {
      "mwoAuth": [
        "default"
      ]
    }
  ],
  "x-cli-cmd-groups": {
    "async": {
      "short": "Manage async operations",
      "long": "Manage async operations"
    },
    "token": {
      "short": "Manage token operations",
      "long": "Manage token operations"
    },
    "blog": {
      "short": "Manage blog articles",
      "long": "Manage blog articles"
    },
    "clients": {
      "short": "Manage client account",
      "long": "Manage client account"
    },
    "corporates": {
      "short": "Manage corporate account",
      "long": "Manage corporate account",
      "parent": "clients"
    },
    "documents": {
      "short": "Manage documents",
      "long": "Manage documents"
    },
    "glossaries": {
      "short": "Manage glossaries",
      "long": "Manage glossaries"
    },
    "styleguides": {
      "short": "Manage style guides",
      "long": "Manage style guides"
    },
    "projects": {
      "short": "Manage projects",
      "long": "Manage projects"
    },
    "activities": {
      "short": "Manage activities",
      "long": "Manage activities",
      "parent": "projects"
    },
    "translations": {
      "short": "Manage translations",
      "long": "Manage translations",
      "parent": "projects"
    },
    "project-documents": {
      "short": "Manage project source documents",
      "long": "Manage project source documents",
      "parent": "projects"
    },
    "reports": {
      "short": "Manage reports",
      "long": "Manage reports"
    },
    "search": {
      "short": "Manage search operations",
      "long": "Manage search operations"
    },
    "static": {
      "short": "Manage static endpoints",
      "long": "Manage static endpoints"
    },
    "stats": {
      "short": "Manage stats",
      "long": "Manage stats"
    },
    "strings": {
      "short": "Manage strings",
      "long": "Manage strings"
    },
    "users": {
      "short": "Manage users",
      "long": "Manage users"
    },
    "vendors": {
      "short": "Manage vendors",
      "long": "Manage vendors",
      "parent": "users"
    },
    "webhooks": {
      "short": "Manage webhooks",
      "long": "Manage webhooks"
    },
    "continuous-projects": {
      "short": "Manage your continuous projects",
      "long": "Manage your continuous localization or translation projects"
    }
  },
  "paths": {
    "/oauth/token": {
      "post": {
        "summary": "Retrieve an access token",
        "description": "MotaWord API is using OAuth2 procedures when authenticating or authorizing your API call.\n",
        "operationId": "getOAuthAccessToken",
        "x-cli-cmd-group": "auth",
        "tags": [
          "Auth"
        ],
        "security": [
          {
            "basicAuth": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TokenRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authentication response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Token"
                }
              }
            }
          },
          "default": {
            "description": "Authentication error - for vendor auth, it will also fail if their account is not approved yet. In that case, the error response will include \"account_status\" key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenError"
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://api.motaword.com"
    },
    {
      "url": "https://sandbox.motaword.com"
    },
    {
      "url": "http://localhost"
    }
  ],
  "components": {
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic"
      },
      "mwoAuth": {
        "description": "OAuth2 authentication, Client Credentials flow.",
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "/token",
            "scopes": {
              "privileged": "privileged",
              "default": "default"
            }
          },
          "password": {
            "tokenUrl": "/token",
            "refreshUrl": "/token",
            "scopes": {
              "privileged": "privileged",
              "default": "default"
            }
          },
          "authorizationCode": {
            "authorizationUrl": "https://www.motaword.com/auth/authorize",
            "tokenUrl": "/token",
            "refreshUrl": "/token",
            "scopes": {
              "privileged": "privileged",
              "default": "default"
            }
          }
        }
      }
    },
    "schemas": {
      "TokenRequest": {
        "properties": {
          "grant_type": {
            "description": "OAuth2 grant type. We publicly support 'client_credentials' or 'refresh_token' grant types, while other strategies are also possible but not allowed regularly.",
            "x-public-description": "OAuth2 grant type. We publicly support 'client_credentials' or 'refresh_token' grant types, while other strategies are also possible but not allowed regularly.",
            "type": "string"
          },
          "scope": {
            "description": "Authorization scope. Use 'privileged' for private endpoints.",
            "type": "string"
          },
          "refresh_token": {
            "description": "Refresh token value for refresh token flow.",
            "type": "string"
          }
        },
        "required": [
          "grant_type",
          "scope"
        ]
      },
      "Token": {
        "properties": {
          "access_token": {
            "type": "string"
          },
          "refresh_token": {
            "type": "string"
          },
          "expires_in": {
            "type": "integer",
            "format": "int64"
          },
          "token_type": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "user_id": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "TokenError": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          },
          {
            "type": "object",
            "properties": {
              "account_status": {
                "type": "string",
                "enum": [
                  "registered",
                  "email_confirmed",
                  "deleted",
                  "suspended",
                  "rejected",
                  "approved",
                  "resume",
                  "webinar",
                  "course"
                ]
              }
            }
          }
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "http_code": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "help": {
            "type": "string"
          },
          "extra_data": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/AdditionalErrorData"
            },
            "description": "Additional structured data related to the error."
          }
        }
      },
      "AdditionalErrorData": {
        "type": "object",
        "properties": {
          "file_id": {
            "type": "string"
          },
          "file_size": {
            "type": "integer"
          },
          "additional_info": {
            "type": "string"
          }
        }
      }
    }
  }
}
```