# ขอไฟล์หลักฐานตามช่วงวัน

Source: https://checkslip.com/docs/create-evidence-export

POST `https://api.checkslip.com/api/audit/exports`

ใช้ API key

สร้างไฟล์หลักฐานของบัญชีตามช่วงวัน UTC ที่เลือก ใช้ยื่นให้ผู้สอบบัญชี ธนาคาร หรือศาล · ตอบ 202 พร้อม status เป็น QUEUED (รอคิว) แล้วถาม GET ด้วย export_id จนกว่าจะเป็น READY (พร้อมดาวน์โหลด) หรือ FAILED (สร้างไม่สำเร็จ) · ไฟล์มีกิจกรรมของบัญชี (AUDIT_EVENTS) ทุกรายการของแต่ละวัน แต่ละบรรทัดเหมือนที่ GET /api/audit/events ให้ · ขอได้เฉพาะวันที่ปิดแล้ว วันนี้ขอไม่ได้ และวันก่อนหน้าขอได้หลังเที่ยงคืน UTC ไปแล้ว 10 นาที (ตั้งงานอัตโนมัติให้เริ่มหลัง 07:10 เวลาไทย) ครั้งละไม่เกิน 31 วัน · ไฟล์ถูกลบหลังเวลา expires_at แต่ manifest ยังอยู่ ดาวน์โหลดเก็บไว้ก่อนเวลานั้น · ไม่หักเครดิต · ส่ง header Idempotency-Key ส่งซ้ำด้วยค่าเดิมได้ไฟล์เดิม ไม่สร้างใหม่ · ใช้ API key ที่มีสิทธิ์ทั้ง audit:read และ audit:export หรือเข้าสู่ระบบบนเว็บแอป · ถ้าขอผ่านผู้ช่วย Checkslip ต้องยืนยันรหัสผ่านก่อน แล้วส่ง step_up_proof มาด้วย

## Parameters

| ฟิลด์ | ส่งทาง | ชนิด | จำเป็น |
| --- | --- | --- | --- |
| `Idempotency-Key` | header | `string` | ใช่ |

## Request body

`application/json`

| ฟิลด์ | ชนิด | จำเป็น |
| --- | --- | --- |
| `from_day` | `string (date)` | ใช่ |
| `to_day` | `string (date)` | ใช่ |
| `streams` | `AUDIT_EVENTS[]` | ไม่ |
| `step_up_proof` | `string` | ไม่ |

## Responses

### 202 `application/json`

| ฟิลด์ | ชนิด | จำเป็น |
| --- | --- | --- |
| `export_id` | `string (uuid)` | ใช่ |
| `status` | `QUEUED \| RUNNING \| READY \| FAILED \| EXPIRED` | ใช่ |
| `from_day` | `string (date)` | ใช่ |
| `to_day` | `string (date)` | ใช่ |
| `streams` | `AUDIT_EVENTS[]` | ใช่ |
| `created_at` | `string (date-time)` | ใช่ |
| `created_by` | `ExportCreator` | ไม่ |
| `created_by.type` | `USER \| API_KEY \| ASSISTANT \| STAFF \| SYSTEM` | ใช่ |
| `created_by.id` | `string (uuid) \| null` | ไม่ |
| `ready_at` | `string (date-time) \| null` | ไม่ |
| `expires_at` | `string (date-time) \| null` | ไม่ |
| `manifest` | `ExportManifest \| null` | ไม่ |

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

400 401 403 409 422 429

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

**cURL**

```bash
curl https://api.checkslip.com/api/audit/exports \
  -H "Authorization: Bearer $CHECKSLIP_API_KEY" \
  -H "Idempotency-Key: order-1042-slip-1" \
  -H "Content-Type: application/json" \
  -d '{"from_day":"2026-11-05","to_day":"2026-11-05","streams":["AUDIT_EVENTS"],"step_up_proof":"string"}'
```

**Node.js**

```javascript
const res = await fetch("https://api.checkslip.com/api/audit/exports", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.CHECKSLIP_API_KEY}`,
    "Idempotency-Key": "order-1042-slip-1",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    from_day: "2026-11-05",
    to_day: "2026-11-05",
    streams: ["AUDIT_EVENTS"],
    step_up_proof: "string",
  }),
});
const data = await res.json();
```

**Python**

```python
import os

import requests

res = requests.post(
    "https://api.checkslip.com/api/audit/exports",
    headers={
        "Authorization": f"Bearer {os.environ['CHECKSLIP_API_KEY']}",
        "Idempotency-Key": "order-1042-slip-1",
    },
    json={
        "from_day": "2026-11-05",
        "to_day": "2026-11-05",
        "streams": ["AUDIT_EVENTS"],
        "step_up_proof": "string",
    },
)
data = res.json()
```

```json
{
  "export_id": "0b6c2f5e-8a41-4d1e-9c3a-5f7e2d18a6b4",
  "status": "QUEUED",
  "from_day": "2026-11-05",
  "to_day": "2026-11-05",
  "streams": [
    "AUDIT_EVENTS"
  ],
  "created_at": "2026-11-05T09:30:00+07:00",
  "created_by": {
    "type": "USER",
    "id": "0b6c2f5e-8a41-4d1e-9c3a-5f7e2d18a6b4"
  },
  "ready_at": "2026-11-05T09:30:00+07:00",
  "expires_at": "2026-11-05T09:30:00+07:00",
  "manifest": {
    "format": "checkslip-audit-export/3",
    "record_count": 1,
    "sha256": "string",
    "size_bytes": 1
  }
}
```
