API Keys

When performing operations on API Keys for a specific user, you must be authenticated using a Production API Key.


API Keys object

id
string
The ID of the authenticated User making the request
children
API Keys array
A list of all Child Users presented with ONLY id, children, and keys
keys
API Keys array
The list of all API keys active for an account, both for "test" and "production" modes.
API Keys Object
{
  "id": "user_060ab38db3c04ffaa60f262e5781a9be",
  "keys": [
    {
      "object": "ApiKey",
      "active": true,
      "key": "<REDACTED>",
      "mode": "test",
      "created_at": "2022-10-14T17:23:58Z",
      "id": "ak_eb495dfd453647749dc6471290b33685"
    },
    {
      "object": "ApiKey",
      "active": true,
      "key": "<REDACTED>",
      "mode": "production",
      "created_at": "2022-10-14T17:23:58Z",
      "id": "ak_6f4eae3909464f3f807b3af2a687c85b"
    }
  ],
  "children": [
    {
      "id": "user_0ae8cb7000a1438c8598fa5786fdae84",
      "keys": [
        {
          "object": "ApiKey",
          "active": true,
          "key": "<REDACTED>",
          "mode": "test",
          "created_at": "2022-10-17T17:28:30Z",
          "id": "ak_3b56830ab851496f946c368cb001c3f4"
        },
        {
          "object": "ApiKey",
          "active": true,
          "key": "<REDACTED>",
          "mode": "production",
          "created_at": "2022-10-17T17:28:30Z",
          "id": "ak_e5020ebb06b84733891c0e0e5ce25b27"
        }
      ],
      "children": []
    }
  ]
}

API Key object

id
string
The ID of the API Key
object
string
"ApiKey"
mode
string
"test" or "production"
key
string
The actual key value to use for authentication
created_at
datetime
When the API Key was created
active
boolean
Whether or not the API Key is active
API Key Object
{
  "object": "ApiKey",
  "active": true,
  "key": "<REDACTED>",
  "mode": "test",
  "created_at": "2022-10-14T17:23:58Z",
  "id": "ak_eb495dfd453647749dc6471290b33685"
}

Production OnlyThis call will only work with your Production API Key.

Create an API Key

Important: This endpoint only works for ReferralCustomers or to manage Child Useraccounts. If you feel this is applicable for your use case, please contact sales.

Both Production and Test API Keys can be created for a User and all of its children. If the request is authenticated as a Child User, only the API Keys for that Child User will be created.

Request Parameters

mode
i.e. "test", "production"
POST /api_keys
1curl -X POST https://api.easypost.com/v2/api_keys \
2  -u "EASYPOST_API_KEY": \
3  -H 'Content-Type: application/json' \
4  -d '{
5    "mode": "test"
6  }'
Response
1{
2  "object": "ApiKey",
3  "key": "<REDACTED>",
4  "mode": "test",
5  "created_at": "2022-01-29T00:02:36Z",
6  "active": true,
7  "id": "ak_..."
8}

Production OnlyThis call will only work with your Production API Key.

Disable an API Key

Important: This endpoint only works for ReferralCustomers or to manage Child Useraccounts. If you feel this is applicable for your use case, please contact sales.

Disabling an API Key immediately renders it unusable. You can disable Production and Test API Keys, but you must use your Production API Key to authenticate. Please exercise caution when disabling API Keys.

POST /api_keys/:id/disable
1curl -X POST https://api.easypost.com/v2/api_keys/ak_.../disable \
2  -u "EASYPOST_API_KEY":
Response
1{
2  "object": "ApiKey",
3  "key": "<REDACTED>",
4  "mode": "test",
5  "created_at": "2022-01-29T00:02:36Z",
6  "active": false,
7  "id": "ak_..."
8}

Production OnlyThis call will only work with your Production API Key.

Enable an API Key

Important: This endpoint only works for ReferralCustomers or to manage Child Useraccounts. If you feel this is applicable for your use case, please contact sales.

You can enable an API Key if it is disabled.

POST /api_keys/:id/enable
1curl -X POST https://api.easypost.com/v2/api_keys/ak_.../enable \
2  -u "EASYPOST_API_KEY":
Response
1{
2  "object": "ApiKey",
3  "key": "<REDACTED>",
4  "mode": "test",
5  "created_at": "2022-01-29T00:02:36Z",
6  "active": true,
7  "id": "ak_..."
8}

Production OnlyThis call will only work with your Production API Key.

Retrieve an API Key

Both Production and Test API Keys will be returned for a User and all of its children. If the request is authenticated as a Child User, only the API Keys for that Child User will be returned.

GET /api_keys
1curl -X GET https://api.easypost.com/v2/api_keys \
2  -u "EASYPOST_API_KEY":
Response
1{
2  "id": "user_060ab38db3c04ffaa60f262e5781a9be",
3  "keys": [
4    {
5      "object": "ApiKey",
6      "active": true,
7      "key": "<REDACTED>",
8      "mode": "test",
9      "created_at": "2022-10-14T17:23:58Z",
10      "id": "ak_eb495dfd453647749dc6471290b33685"
11    },
12    {
13      "object": "ApiKey",
14      "active": true,
15      "key": "<REDACTED>",
16      "mode": "production",
17      "created_at": "2022-10-14T17:23:58Z",
18      "id": "ak_6f4eae3909464f3f807b3af2a687c85b"
19    }
20  ],
21  "children": [
22    {
23      "id": "user_0ae8cb7000a1438c8598fa5786fdae84",
24      "keys": [
25        {
26          "object": "ApiKey",
27          "active": true,
28          "key": "<REDACTED>",
29          "mode": "test",
30          "created_at": "2022-10-17T17:28:30Z",
31          "id": "ak_3b56830ab851496f946c368cb001c3f4"
32        },
33        {
34          "object": "ApiKey",
35          "active": true,
36          "key": "<REDACTED>",
37          "mode": "production",
38          "created_at": "2022-10-17T17:28:30Z",
39          "id": "ak_e5020ebb06b84733891c0e0e5ce25b27"
40        }
41      ],
42      "children": []
43    }
44  ]
45}

Production OnlyThis call will only work with your Production API Key.

Delete an API Key

Important: This endpoint only works for ReferralCustomers or to manage Child Useraccounts. If you feel this is applicable for your use case, please contact sales.

Once an API Key is deleted, it cannot be re-enabled, and will no longer be shown in your list of keys. Please exercise caution when deleting API Key.

DELETE /api_keys/:id
1curl -X DELETE https://api.easypost.com/v2/api_keys/ak_... \
2  -u "EASYPOST_API_KEY":
Response
1{}