<!-- Markdown version of https://dcast.pro/docs/quickstart (Quickstart). Index of all pages: https://dcast.pro/llms.txt -->

# Quickstart

Get from signup to your first API call in a few minutes.

## 1. Sign up and get an API key

[Sign up](https://dcast.pro/signup) on dcast.pro, then in the dashboard go to **Settings → API Keys** and create a key. You can create a **trial key** with a limited number of requests to try the API without commitment. Copy the key (it is shown only once).

## 2. Check API health (no key)

```
curl -s https://api.dcast.pro/api/v1/health
```

Expected: `{ "success": true, "data": { "status": "healthy", ... } }`

## 3. Call an endpoint with your key

Replace `pk_YOUR_KEY_HERE` with your key (`pk_` followed by 40 hex characters).

```
curl -s -H "Authorization: Bearer pk_YOUR_KEY_HERE" https://api.dcast.pro/api/v1/me
```

Returns the full account profile (40+ fields: `email`, `username`, `displayName`, `bio`, `avatarUrl`, `socials`, `siteSettings`, `plan`, `embedAllowlist`, …) plus key metadata (`keyId`, `scope`, `rateLimit`). See [Account & quota](https://dcast.pro/docs/account) for the full shape.

## 4. List videos

```
curl -s -H "Authorization: Bearer YOUR_API_KEY" "https://api.dcast.pro/api/v1/videos?page=1&limit=20"
```

## 5. Upload a video (Direct Upload)

Step 1 — get a signed upload URL (`POST /videos/upload` or alias `POST /videos`, same body):

```
curl -s -X POST https://api.dcast.pro/api/v1/videos/upload \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"My Video","fileName":"video.mp4","fileSize":10485760,"visibility":"PRIVATE"}'
```

Step 2 — upload the file with `PUT` to the `upload.url` from the response. See [Videos](https://dcast.pro/docs/video-api) for full details.

## 6. Security & scope

Every `pk_*` key is **creator-scoped**: it can only read and mutate resources owned by the account that minted it. Keys cannot escalate to admin operations, cannot manage payout / withdrawal flows, and cannot operate on other creators' private data. Payout-account onboarding, status, and dashboard are **admin-only**; see [Monetization](https://dcast.pro/docs/monetization).

## 7. QA checklist (must use `/api/v1` prefix)

Replace `pk_YOUR_KEY_HERE` and ids. A **401** with a bad key means the route exists; **404** usually means the path is wrong (missing `/api/v1` or typo).

```
# Account + analytics (aliases included)
curl -s -H "Authorization: Bearer pk_YOUR_KEY_HERE" "https://api.dcast.pro/api/v1/account/analytics"
# /summary and /stats need a FULL_ACCESS key or finance:read (otherwise 403 FINANCIAL_SCOPE_REQUIRED)
curl -s -H "Authorization: Bearer pk_YOUR_KEY_HERE" "https://api.dcast.pro/api/v1/summary"
curl -s -H "Authorization: Bearer pk_YOUR_KEY_HERE" "https://api.dcast.pro/api/v1/stats"

# Room create — POST (canonical) or PUT (same JSON)
curl -s -X POST "https://api.dcast.pro/api/v1/rooms" -H "Authorization: Bearer pk_YOUR_KEY_HERE" -H "Content-Type: application/json" \
  -d '{"title":"QA Room","type":"INSTANT","maxParticipants":10}'

# Restream — title required; omit streamId/sourceStreamId unless linking YOUR stream id
curl -s -X POST "https://api.dcast.pro/api/v1/restreams" -H "Authorization: Bearer pk_YOUR_KEY_HERE" -H "Content-Type: application/json" \
  -d '{"title":"QA Restream","destinations":[]}'

# Comment on YOUR video (use a video id from GET /videos)
curl -s -X POST "https://api.dcast.pro/api/v1/videos/VIDEO_ID/comments" -H "Authorization: Bearer pk_YOUR_KEY_HERE" -H "Content-Type: application/json" \
  -d '{"text":"Hello from API test"}'

# Stream creation — supports RTMP, SRT, WEBRTC, HTTP, FILE protocols
# RTMP (default)
curl -s -X POST "https://api.dcast.pro/api/v1/streams" -H "Authorization: Bearer pk_YOUR_KEY_HERE" -H "Content-Type: application/json" \
  -d '{"title":"RTMP Stream","protocol":"RTMP"}'

# SRT
curl -s -X POST "https://api.dcast.pro/api/v1/streams" -H "Authorization: Bearer pk_YOUR_KEY_HERE" -H "Content-Type: application/json" \
  -d '{"title":"SRT Stream","protocol":"SRT"}'

# HTTP (pull) — requires httpSourceUrl
curl -s -X POST "https://api.dcast.pro/api/v1/streams" -H "Authorization: Bearer pk_YOUR_KEY_HERE" -H "Content-Type: application/json" \
  -d '{"title":"HTTP Pull Stream","protocol":"HTTP","httpSourceUrl":"https://example.com/live.m3u8"}'

# FILE — requires fileSourceUrl: a public http(s) URL of a media file (not a local path,
# not a DCAST video id). It is checked when the stream starts.
curl -s -X POST "https://api.dcast.pro/api/v1/streams" -H "Authorization: Bearer pk_YOUR_KEY_HERE" -H "Content-Type: application/json" \
  -d '{"title":"FILE Stream","protocol":"FILE","fileSourceUrl":"https://media.example.com/show.mp4"}'
```
