# Pricing API

## Introduction
The EchoSync Pricing API enables you to request freight quotes for truckload (TL) shipments.
The API provides pricing, transit times, and service options for your shipping needs.
## Authentication
The API supports two authentication methods:
### OAuth 2.0
> This Authentication method is **Recommended**.

To access this API, you first need to generate an **Access Token** using your unique Client Credentials:
1. **Request a Token:** Use your `Client ID` and `Client Secret` at Authorization Server: `https://auth.echo.com`
2. **Get the Token:** The server will provide a unique **Access Token**
3. **Use the Token:** Add this token to your request headers as:

```
Authorization: Bearer {your_token}
```

**Token Lifecycle:**
- Access tokens are valid for **86400 seconds** (24 hours) from the time they are issued
- Reuse tokens until expiration to avoid rate limiting
- Request a new token only after the current one expires

### Basic Authentication
Alternatively, use Basic Authentication with Base64-encoded credentials:

```
Authorization: Basic {base64(client_id:client_secret)}
```
## Rate Limits
- **API Requests:** Maximum 3 requests per second
- **Token Requests:** Avoid requesting new tokens multiple times per hour

Exceeding these limits may result in rate limiting or temporary access suspension.
## Considerations
- **Versioning:** While **`V1`** is still supported for our current users, it is **NO longer available for new onboardings**.
To take advantage of enhanced reference handling, all new integrations should use **`V2`**.
- **Functionality:** The EchoSync Pricing API provides two versions.
The functionality is identical except for the reference number field:
  - v2: referencenumbertype
  - v1: type

Version: v1.5.0

## Servers

Production server
```
https://customerapi.echo.com/oauth
```

Testing server
```
https://customerapi-qa.qa.echo.com/oauth
```

Development server
```
https://customerapi-dev.dev1.echo.com/oauth
```

## Security

### generate_quote_authorization

Provide an `Authorization` header with a valid token to access this endpoint.

Type: apiKey
In: header
Name: Authorization

### get_quote_authorization

Provide an `Authorization` header with a valid token to access this endpoint.

Type: apiKey
In: header
Name: Authorization

## Download OpenAPI description

 - [Pricing API](https://echo-api.redocly.app/_bundle/pricing-api/openapi-spec/main-api.yaml)

## quotes

 - [POST /v1/quotes](https://echo-api.redocly.app/pricing-api/openapi-spec/main-api/quotes/v1generatequotepost.md): Used for creating quotes for both truckload and partial load shipments. **Truckload Mode (tl):** - Freight information is optional - Stop locationType is optional **Partial Mode (pl):** - Freight inf
 - [GET /v1/quotes/{id}](https://echo-api.redocly.app/pricing-api/openapi-spec/main-api/quotes/v1getquotesget.md): Used for retrieving quotes.
 - [POST /v2/quotes](https://echo-api.redocly.app/pricing-api/openapi-spec/main-api/quotes/v2generatequotepost.md): Used for creating quotes for both truckload and partial load shipments (v2). **Truckload Mode (tl):** - Freight information is optional - Stop locationType is optional **Partial Mode (pl):** - Freigh
 - [GET /v2/quotes/{id}](https://echo-api.redocly.app/pricing-api/openapi-spec/main-api/quotes/v2getquotesget.md): Used for retrieving quotes (v2).
## health

 - [GET /v2/__health](https://echo-api.redocly.app/pricing-api/openapi-spec/main-api/health/v2healthcheckget.md): Used for checking healthy/unhealthy endpoints for quote service.
 - [GET /v2/__health/get_quote](https://echo-api.redocly.app/pricing-api/openapi-spec/main-api/health/v2healthcheckgetquoteget.md): Health check for get quote endpoint
 - [GET /v2/__health/generate_quote](https://echo-api.redocly.app/pricing-api/openapi-spec/main-api/health/v2healthcheckgeneratequoteget.md): Health check for generate quote endpoint
## CORS

 - [OPTIONS /v1/quotes](https://echo-api.redocly.app/pricing-api/openapi-spec/main-api/cors/v1generatequotecors.md): Enable CORS by returning correct headers.
 - [OPTIONS /v1/quotes/{id}](https://echo-api.redocly.app/pricing-api/openapi-spec/main-api/cors/v1getquotecors.md): Enable CORS by returning correct headers.
 - [OPTIONS /v2/quotes](https://echo-api.redocly.app/pricing-api/openapi-spec/main-api/cors/v2generatequotecors.md): Enable CORS by returning correct headers.
 - [OPTIONS /v2/quotes/{id}](https://echo-api.redocly.app/pricing-api/openapi-spec/main-api/cors/v2getquotecors.md): Enable CORS by returning correct headers.
 - [OPTIONS /v2/__health](https://echo-api.redocly.app/pricing-api/openapi-spec/main-api/cors/v2healthcheckcors.md): Enable CORS by returning correct headers.
 - [OPTIONS /v2/__health/get_quote](https://echo-api.redocly.app/pricing-api/openapi-spec/main-api/cors/v2healthcheckgetquotecors.md): Enable CORS by returning correct headers.
 - [OPTIONS /v2/__health/generate_quote](https://echo-api.redocly.app/pricing-api/openapi-spec/main-api/cors/v2healthcheckgeneratequotecors.md): Enable CORS by returning correct headers.
