# API介紹

> 基本URL、認證、格式和協議。

## 基礎 URL

```
https://sendtern.com
```

所有生產請求都使用 HTTPS 。

## 認證

發送一個 [API 鍵](https://sendtern.com/docs/authentication) 在 `Authorization` 頭。鍵範圍為一個工作空間。

```
Authorization: Bearer st_your_api_key
```

## 請求和回應

- 請求的主體是JSON與`Content-Type: application/json`。
- 回應是JSON，除了`204 No Content`的刪除。
- 時間戳是ISO 8601 UTC字符串。
- ID 是UUID

## 分頁

電子郵件列表使用`limit`(最多100)和前一頁可選的`after`光標。

```
{
  "object": "list",
  "data": [],
  "has_more": false
}
```

## 狀態碼

| 代碼 | 意義 |
| --- | --- |
| 200 | 成功 |
| 202 | 接受，處理在後台繼續進行 |
| 204 | 成功 ， 沒有身體 |
| 4xx | 請求出錯了。請參閱 [錯誤](https://sendtern.com/docs/errors) |
| 5xx | 我們的系統出錯了，可以使用同位鍵重試 |

## 終點

- [電子郵件](https://sendtern.com/docs/api-send-email): 發送、取得、列出、計算。
- [域名](https://sendtern.com/docs/api-create-domain): 添加、驗證和移除發送域名。
- [API 鍵](https://sendtern.com/docs/api-create-api-key): 創建、列出和撤銷密鑰。
