# เพิ่ม endpoint

Source: https://checkslip.com/docs/create-endpoint

POST `https://api.checkslip.com/api/webhooks/endpoints`

ใช้ API key

ลงทะเบียน URL ของระบบของคุณให้รับข้อความตามประเภทใน event_types · คำตอบมี secret สำหรับเทียบลายเซ็นของทุกข้อความ ซึ่งแสดงครั้งเดียวในคำตอบนี้ เก็บไว้ทันที ถ้าหายให้เปลี่ยน signing secret ใหม่ · URL ต้องเป็น https ไม่มี user:pass@ และทุก IP ที่โดเมนชี้ไปต้องเป็น IP สาธารณะ (มีตัวใดเป็น IP ภายใน ระบบปฏิเสธ) ระบบเช็กซ้ำทุกครั้งที่ส่ง · บัญชีหนึ่งมี endpoint ได้ไม่เกิน 16 อัน · เจ้าของบัญชีได้รับอีเมลแจ้งทุกครั้งที่มีการเพิ่ม endpoint · ใช้ API key ที่มีสิทธิ์ webhook:manage

## Parameters

| ฟิลด์ | ส่งทาง | ชนิด | จำเป็น |
| --- | --- | --- | --- |
| `traceparent` | header | `string` | ไม่ |

## Request body

`application/json`

| ฟิลด์ | ชนิด | จำเป็น |
| --- | --- | --- |
| `url` | `string (uri)` | ใช่ |
| `description` | `string` | ไม่ |
| `event_types` | `slip.checked \| webhook.test[]` | ใช่ |

## Responses

### 201 `application/json`

### Error ที่อาจได้

400 401 403 409 422

error ในรูป Problem Details ดูรหัสทั้งหมดที่ [รหัสข้อผิดพลาด](https://checkslip.com/docs/errors)

**cURL**

```bash
curl https://api.checkslip.com/api/webhooks/endpoints \
  -H "Authorization: Bearer $CHECKSLIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/hooks/checkslip","description":"string","event_types":["slip.checked"]}'
```

**Node.js**

```javascript
const res = await fetch("https://api.checkslip.com/api/webhooks/endpoints", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.CHECKSLIP_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://example.com/hooks/checkslip",
    description: "string",
    event_types: ["slip.checked"],
  }),
});
const data = await res.json();
```

**Python**

```python
import os

import requests

res = requests.post(
    "https://api.checkslip.com/api/webhooks/endpoints",
    headers={
        "Authorization": f"Bearer {os.environ['CHECKSLIP_API_KEY']}",
    },
    json={
        "url": "https://example.com/hooks/checkslip",
        "description": "string",
        "event_types": ["slip.checked"],
    },
)
data = res.json()
```

```json
{
  "id": "string",
  "url": "https://example.com/hooks/checkslip",
  "description": "string",
  "event_types": [
    "slip.checked"
  ],
  "enabled": true,
  "disabled_reason": "MANUAL",
  "secret_hint": "string",
  "previous_secret_expires_at": "2026-11-05T09:30:00+07:00",
  "created_at": "2026-11-05T09:30:00+07:00",
  "updated_at": "2026-11-05T09:30:00+07:00",
  "secret": "string"
}
```
