---
title: "Retrieve an Access Token"
method: POST
path: "/oauth2/token"
tags: ["Authorization"]
---

# Retrieve an Access Token

`POST /oauth2/token`

Retrieve an OAuth 2 Access Token.

There are two ways of accessing the child companies:

1. **Client Credentials Grant** with a `enterprise.child_company::access` scope and a custom header `X_EASYSHIP_COMPANY_ID` in each request to our Public API.
2. A custom **Delegated Account Grant**, that will generate access and refresh tokens associated with a specific child company defined in the `easyship_company_id`.

## Request body

- union
  - OAuth2ClientCredentialsRequest — OAuth 2 Client Credentials Request
    - `grant_type` 'client_credentials', required — OAuth 2 Grant Type
    - `client_id` string, required — OAuth 2 Client ID
    - `client_secret` string, required — OAuth 2 Client Secret
    - `scope` string, required — OAuth 2 Scopes separated by space. All Enterprise and Public API scopes are supported, but they must be allowed on the Enterprise API Client Application on the Dashboard. |Scope|Description| |---|---| |address|Addresses API (2023-01 and older)| |asset|Assets API (2023-01 and older)| |billing_document|Billing Documents API (2023-01 and older)| |box|Boxes API (2023-01 and older)| |courier|Couriers API (2023-01 and older)| |courier_account|Courier Accounts API (2023-01 and older)| |credit|Credits API (2023-01 and older)| |hs_code|Hs Codes API (2023-01 and older)| |label|Labels API (2023-01 and older)| |pickup|Pickups API (2023-01 and older)| |product|Products API (2023-01 and older)| |rate|Rates API (2023-01 and older)| |reference|References API (2023-01 and older)| |settings|Settings API (2023-01 and older)| |shipment|Shipments API (2023-01 and older)| |shipment_document|Shipment Documents API (2023-01 and older)| |store|Stores API (2023-01 and older)| |tag|Tags API (2023-01 and older)| |tax_and_duty|Tax And Duties API (2023-01 and older)| |track|Tracks API (2023-01 and older)| |transaction_record|Transaction Records API (2023-01 and older)| |webhook|Webhooks API (2023-01 and older)| |public.address:read|Addresses (read only) Public API (2024-09 and newer)| |public.address:write|Addresses (write only) Public API (2024-09 and newer)| |public.analytics:read|Analytics (read only) Public API (2024-09 and newer)| |public.app_access:write|App Accesses (write only) Public API (2024-09 and newer)| |public.asset:read|Assets (read only) Public API (2024-09 and newer)| |public.asset:write|Assets (write only) Public API (2024-09 and newer)| |public.batch:read|Batches (read only) Public API (2024-09 and newer)| |public.batch:write|Batches (write only) Public API (2024-09 and newer)| |public.billing_document:read|Billing Documents (read only) Public API (2024-09 and newer)| |public.billing_document:write|Billing Documents (write only) Public API (2024-09 and newer)| |public.box:read|Boxes (read only) Public API (2024-09 and newer)| |public.box:write|Boxes (write only) Public API (2024-09 and newer)| |public.courier:read|Couriers (read only) Public API (2024-09 and newer)| |public.courier:write|Couriers (write only) Public API (2024-09 and newer)| |public.courier_service:read|Courier Services (read only) Public API (2024-09 and newer)| |public.credit:read|Credits (read only) Public API (2024-09 and newer)| |public.hs_code:read|Hs Codes (read only) Public API (2024-09 and newer)| |public.label:write|Labels (write only) Public API (2024-09 and newer)| |public.location:read|Locations (read only) Public API (2024-09 and newer)| |public.manifest:read|Manifests (read only) Public API (2024-09 and newer)| |public.manifest:write|Manifests (write only) Public API (2024-09 and newer)| |public.payment:write|Payments (write only) Public API (2024-09 and newer)| |public.payment_source:read|Payment Sources (read only) Public API (2024-09 and newer)| |public.payment_source:write|Payment Sources (write only) Public API (2024-09 and newer)| |public.pickup:read|Pickups (read only) Public API (2024-09 and newer)| |public.pickup:write|Pickups (write only) Public API (2024-09 and newer)| |public.product:read|Products (read only) Public API (2024-09 and newer)| |public.product:write|Products (write only) Public API (2024-09 and newer)| |public.rate:read|Rates (read only) Public API (2024-09 and newer)| |public.redirect:write|Redirects (write only) Public API (2024-09 and newer)| |public.reference:read|References (read only) Public API (2024-09 and newer)| |public.setting:read|Settings (read only) Public API (2024-09 and newer)| |public.setting:write|Settings (write only) Public API (2024-09 and newer)| |public.shipment:read|Shipments (read only) Public API (2024-09 and newer)| |public.shipment:write|Shipments (write only) Public API (2024-09 and newer)| |public.shipment_document:read|Shipment Documents (read only) Public API (2024-09 and newer)| |public.shipping_rule:read|Shipping Rules (read only) Public API (2024-09 and newer)| |public.shipping_rule:write|Shipping Rules (write only) Public API (2024-09 and newer)| |public.store:read|Stores (read only) Public API (2024-09 and newer)| |public.tag:read|Tags (read only) Public API (2024-09 and newer)| |public.tag:write|Tags (write only) Public API (2024-09 and newer)| |public.tax_and_duty:read|Tax And Duties (read only) Public API (2024-09 and newer)| |public.track:read|Tracks (read only) Public API (2024-09 and newer)| |public.transaction_record:read|Transaction Records (read only) Public API (2024-09 and newer)| |public.webhook:read|Webhooks (read only) Public API (2024-09 and newer)| |public.webhook:write|Webhooks (write only) Public API (2024-09 and newer)|
  - OAuth2DelegatedAccountRequest — OAuth 2 Delegated Account Request
    - `grant_type` 'delegated_account', required — OAuth 2 Grant Type
    - `client_id` string, required — OAuth 2 Client ID
    - `client_secret` string, required — OAuth 2 Client Secret
    - `easyship_company_id` string, required — Easyship Company ID of the child company
    - `scope` string, required — OAuth 2 Scopes separated by space. All Enterprise and Public API scopes are supported, but they must be allowed on the Enterprise API Client Application on the Dashboard. |Scope|Description| |---|---| |address|Addresses API (2023-01 and older)| |asset|Assets API (2023-01 and older)| |billing_document|Billing Documents API (2023-01 and older)| |box|Boxes API (2023-01 and older)| |courier|Couriers API (2023-01 and older)| |courier_account|Courier Accounts API (2023-01 and older)| |credit|Credits API (2023-01 and older)| |hs_code|Hs Codes API (2023-01 and older)| |label|Labels API (2023-01 and older)| |pickup|Pickups API (2023-01 and older)| |product|Products API (2023-01 and older)| |rate|Rates API (2023-01 and older)| |reference|References API (2023-01 and older)| |settings|Settings API (2023-01 and older)| |shipment|Shipments API (2023-01 and older)| |shipment_document|Shipment Documents API (2023-01 and older)| |store|Stores API (2023-01 and older)| |tag|Tags API (2023-01 and older)| |tax_and_duty|Tax And Duties API (2023-01 and older)| |track|Tracks API (2023-01 and older)| |transaction_record|Transaction Records API (2023-01 and older)| |webhook|Webhooks API (2023-01 and older)| |public.address:read|Addresses (read only) Public API (2024-09 and newer)| |public.address:write|Addresses (write only) Public API (2024-09 and newer)| |public.analytics:read|Analytics (read only) Public API (2024-09 and newer)| |public.app_access:write|App Accesses (write only) Public API (2024-09 and newer)| |public.asset:read|Assets (read only) Public API (2024-09 and newer)| |public.asset:write|Assets (write only) Public API (2024-09 and newer)| |public.batch:read|Batches (read only) Public API (2024-09 and newer)| |public.batch:write|Batches (write only) Public API (2024-09 and newer)| |public.billing_document:read|Billing Documents (read only) Public API (2024-09 and newer)| |public.billing_document:write|Billing Documents (write only) Public API (2024-09 and newer)| |public.box:read|Boxes (read only) Public API (2024-09 and newer)| |public.box:write|Boxes (write only) Public API (2024-09 and newer)| |public.courier:read|Couriers (read only) Public API (2024-09 and newer)| |public.courier:write|Couriers (write only) Public API (2024-09 and newer)| |public.courier_service:read|Courier Services (read only) Public API (2024-09 and newer)| |public.credit:read|Credits (read only) Public API (2024-09 and newer)| |public.hs_code:read|Hs Codes (read only) Public API (2024-09 and newer)| |public.label:write|Labels (write only) Public API (2024-09 and newer)| |public.location:read|Locations (read only) Public API (2024-09 and newer)| |public.manifest:read|Manifests (read only) Public API (2024-09 and newer)| |public.manifest:write|Manifests (write only) Public API (2024-09 and newer)| |public.payment:write|Payments (write only) Public API (2024-09 and newer)| |public.payment_source:read|Payment Sources (read only) Public API (2024-09 and newer)| |public.payment_source:write|Payment Sources (write only) Public API (2024-09 and newer)| |public.pickup:read|Pickups (read only) Public API (2024-09 and newer)| |public.pickup:write|Pickups (write only) Public API (2024-09 and newer)| |public.product:read|Products (read only) Public API (2024-09 and newer)| |public.product:write|Products (write only) Public API (2024-09 and newer)| |public.rate:read|Rates (read only) Public API (2024-09 and newer)| |public.redirect:write|Redirects (write only) Public API (2024-09 and newer)| |public.reference:read|References (read only) Public API (2024-09 and newer)| |public.setting:read|Settings (read only) Public API (2024-09 and newer)| |public.setting:write|Settings (write only) Public API (2024-09 and newer)| |public.shipment:read|Shipments (read only) Public API (2024-09 and newer)| |public.shipment:write|Shipments (write only) Public API (2024-09 and newer)| |public.shipment_document:read|Shipment Documents (read only) Public API (2024-09 and newer)| |public.shipping_rule:read|Shipping Rules (read only) Public API (2024-09 and newer)| |public.shipping_rule:write|Shipping Rules (write only) Public API (2024-09 and newer)| |public.store:read|Stores (read only) Public API (2024-09 and newer)| |public.tag:read|Tags (read only) Public API (2024-09 and newer)| |public.tag:write|Tags (write only) Public API (2024-09 and newer)| |public.tax_and_duty:read|Tax And Duties (read only) Public API (2024-09 and newer)| |public.track:read|Tracks (read only) Public API (2024-09 and newer)| |public.transaction_record:read|Transaction Records (read only) Public API (2024-09 and newer)| |public.webhook:read|Webhooks (read only) Public API (2024-09 and newer)| |public.webhook:write|Webhooks (write only) Public API (2024-09 and newer)|
  - OAuth2RefreshTokenRequest — OAuth 2 Refresh Token Request
    - `grant_type` 'refresh_token', required — OAuth 2 Grant Type
    - `client_id` string, required — OAuth 2 Client ID
    - `client_secret` string, required — OAuth 2 Client Secret
    - `scope` Scope — unresolved $ref
    - `refresh_token` string, required — OAuth 2 Refresh Token

## Response `200`

Access and Refresh Tokens from Delegated Account grant

- OAuth2TokenResponse — OAuth 2 Token Response
  - `access_token` string — OAuth 2 Access Token
  - `token_type` 'Bearer' — OAuth 2 Token Type
  - `expires_in` integer — OAuth 2 Access Token Expiration Time in Seconds
  - `scope` Scope — unresolved $ref
  - `created_at` integer — OAuth 2 Access Token Creation Time
  - `refresh_token` string, nullable — OAuth 2 Refresh Token. Available only for Authorization Code Grant Type.

## Other responses

- `400` — Invalid Company for Delegated Account

---

[API](https://skmtc.dev/easyship/apis/easyship-public-api.md) · [All operations](https://skmtc.dev/easyship/apis/easyship-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/easyship/easyship-public-api/revisions/71d737a5fcbf/schema)
