# Obtain a bearer token from Echo Global Logistics

Exchanges your application credentials for an OAuth 2.0 Bearer token
using the Client Credentials flow.
Submit your `client_id`, `client_secret`, `grant_type`, and `scope`
as form fields. On success, the response contains the `access_token`
and its expiration time (`expires_in`, in seconds).
Cache and reuse the token for its full lifetime. Only call this
endpoint again after the token expires.

Endpoint: POST /token
Version: 1.0.0

## Request fields (application/x-www-form-urlencoded):

  - `client_id` (string, required)
    The supplied client ID generated for your application

  - `client_secret` (string, required)
    The supplied client secret generated for your application **Required if grant_type is** ***client_credentials***

  - `grant_type` (string, required)
    The type of grant you are using to obtain a token
    Enum: "client_credentials"

  - `scope` (string, required)
    The scope(s) being requested by the application Scopes are space-delimited Scopes that are granted will be returned in the access token **Required if grant_type is** ***client_credentials***
    Enum: "quotes:create", "tender:action", "load_status:read", "invoice:read", "connect_api:action", "loads:read", "loads:action"

## Response 200:

  - `200` (unknown)
    Success

## Response 200 fields (application/json):

  - `access_token` (string)
    JSON Web Token (JWT) that represents a session generated for a client

  - `expires_in` (integer)
    Number of seconds until the session expires

  - `token_type` (string)
    Type of access token - always set to Bearer

  - `scope` (string)
    scope(s) approved with the token

## Response 400:

  - `400` (unknown)
    Bad Request

## Response 400 fields (application/json):

  - `error` (string)
    Short indicator of error type

  - `error_desc` (string)
    Description of error

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 401 fields (application/json):

  - `error` (string)
    Short indicator of error type

  - `error_desc` (string)
    Description of error

## Response 200 examples:

  - `Grant type as client_credentials` (unknown)

## Response 400 examples:

  - `Invalid client id` (unknown)

  - `Grant has been used or has expired` (unknown)

  - `Missing required parameter` (unknown)

## Response 401 examples:

  - `Failed authentication` (unknown)

  - `No access` (unknown)

