> ## Documentation Index
> Fetch the complete documentation index at: https://playcamp.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# API Reference

> Quick reference for all SDK API endpoints

## Error Response Format

```json theme={null}
{
  "error": "Error message",
  "code": "ERROR_CODE"
}
```

## Common Error Codes

| HTTP | Code               | Description                           |
| ---- | ------------------ | ------------------------------------- |
| 400  | `VALIDATION_ERROR` | Request parameter validation failed   |
| 400  | `BAD_REQUEST`      | Invalid request                       |
| 401  | `UNAUTHORIZED`     | Authentication failed (API key error) |
| 403  | `FORBIDDEN`        | Access denied                         |
| 404  | `NOT_FOUND`        | Resource not found                    |
| 409  | `CONFLICT`         | Duplicate resource                    |
| 500  | `INTERNAL_ERROR`   | Internal server error                 |

## Date/Time Format

All date/time values must be sent in **ISO 8601** format in **UTC** timezone.

**Format**

```
YYYY-MM-DDTHH:mm:ss.sssZ
```

**Example**

```json theme={null}
{
  "purchasedAt": "2024-01-15T10:30:00.000Z"
}
```

| Component    | Description               | Example      |
| ------------ | ------------------------- | ------------ |
| `YYYY-MM-DD` | Date (year-month-day)     | `2024-01-15` |
| `T`          | Date and time separator   | `T`          |
| `HH:mm:ss`   | Time (hour:minute:second) | `10:30:00`   |
| `.sss`       | Milliseconds (optional)   | `.000`       |
| `Z`          | UTC timezone indicator    | `Z`          |

<Warning>
  Send times in **UTC**, not local timezone. For example, 7:30 PM KST (Korea Standard Time, UTC+9) should be sent as 10:30 AM UTC (`10:30:00Z`).
</Warning>

**Language Examples**

```javascript theme={null}
// JavaScript
const now = new Date();
const isoString = now.toISOString();
// "2024-01-15T10:30:00.000Z"
```

```python theme={null}
# Python
from datetime import datetime, timezone

now = datetime.now(timezone.utc)
iso_string = now.isoformat(timespec='milliseconds').replace('+00:00', 'Z')
# "2024-01-15T10:30:00.000Z"
```

```java theme={null}
// Java
import java.time.Instant;

String isoString = Instant.now().toString();
// "2024-01-15T10:30:00.000Z"
```

## Server API Endpoints

| Function                                   | Method | Endpoint                                    |
| ------------------------------------------ | ------ | ------------------------------------------- |
| **Boost (Sponsor)**                        |        |                                             |
| Create/Update boost                        | POST   | `/v1/server/sponsors`                       |
| Get boost status                           | GET    | `/v1/server/sponsors/user/:userId`          |
| Remove boost                               | DELETE | `/v1/server/sponsors/user/:userId`          |
| **Payment**                                |        |                                             |
| Create payment                             | POST   | `/v1/server/payments`                       |
| Create bulk payments (up to 1000)          | POST   | `/v1/server/payments/bulk`                  |
| Get payment                                | GET    | `/v1/server/payments/:transactionId`        |
| Get user payments                          | GET    | `/v1/server/payments/user/:userId`          |
| Refund payment                             | POST   | `/v1/server/payments/:transactionId/refund` |
| **Coupon**                                 |        |                                             |
| Validate coupon                            | POST   | `/v1/server/coupons/validate`               |
| Redeem coupon                              | POST   | `/v1/server/coupons/redeem`                 |
| Get user coupons                           | GET    | `/v1/server/coupons/user/:userId`           |
| **Query**                                  |        |                                             |
| List campaigns                             | GET    | `/v1/server/campaigns`                      |
| Get campaign                               | GET    | `/v1/server/campaigns/:id`                  |
| Search creators                            | GET    | `/v1/server/creators/search`                |
| Get creator                                | GET    | `/v1/server/creators/:creatorKey`           |
| Get creator coupons                        | GET    | `/v1/server/creators/:creatorKey/coupons`   |
| **Playtime**                               |        |                                             |
| Record playtime session                    | POST   | `/v1/server/playtime/sessions`              |
| Record bulk playtime sessions (up to 1000) | POST   | `/v1/server/playtime/sessions/bulk`         |
| **WebView**                                |        |                                             |
| Issue WebView one-time token (OTT)         | POST   | `/v1/server/webview/ott`                    |
| **Webhook**                                |        |                                             |
| List webhooks                              | GET    | `/v1/server/webhooks`                       |
| Create webhook                             | POST   | `/v1/server/webhooks`                       |
| Update webhook                             | PUT    | `/v1/server/webhooks/:id`                   |
| Delete webhook                             | DELETE | `/v1/server/webhooks/:id`                   |
| Get webhook logs                           | GET    | `/v1/server/webhooks/:id/logs`              |
| Test webhook                               | POST   | `/v1/server/webhooks/:id/test`              |

## Client API Endpoints

| Function               | Method | Endpoint                            |
| ---------------------- | ------ | ----------------------------------- |
| **Campaign**           |        |                                     |
| List campaigns         | GET    | `/v1/client/campaigns`              |
| Get campaign           | GET    | `/v1/client/campaigns/:id`          |
| List campaign creators | GET    | `/v1/client/campaigns/:id/creators` |
| List campaign packages | GET    | `/v1/client/campaigns/:id/packages` |
| **Creator**            |        |                                     |
| Search creators        | GET    | `/v1/client/creators/search`        |
| Get creator            | GET    | `/v1/client/creators/:creatorKey`   |
| **Coupon**             |        |                                     |
| Validate coupon        | POST   | `/v1/client/coupons/validate`       |
| **Boost (Sponsor)**    |        |                                     |
| Get boost status       | GET    | `/v1/client/sponsors`               |
