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

# Quickstart

> Get an API key, make your first request, and acquire a music stream in under five minutes.

This walkthrough takes you from zero to a working playback URL.

## 1. Get credentials

You need either an **API key** (server-to-server) or an **OAuth access token** (user-scoped).

* **API key** — register at the [Developer Portal](https://developers.anghami.com), create a key in the dashboard, and copy the secret (shown once).
* **OAuth** — use the standard OAuth 2.0 Authorization Code + PKCE flow. See [Authentication](/usage-auth).

```bash theme={null}
export ANGHAMI_API_KEY="ang_live_..."
```

## 2. Browse the catalog

Hit a public catalog endpoint with your API key. Reads are `GET`:

```bash theme={null}
curl -sS "https://sdk.anghami.com/v1/discovery/browse/featured" \
  -H "x-api-key: $ANGHAMI_API_KEY" | jq '.sections[0]'
```

You'll get back curated featured sections (think "Made For You", "Trending Now"). Single-resource reads are `GET`; batch reads (`:batchGet`) and stream acquisition are `POST` with a JSON body.

## 3. Search for a song

```bash theme={null}
curl -sS "https://sdk.anghami.com/v1/discovery/search?query=Fairouz&page_size=5" \
  -H "x-api-key: $ANGHAMI_API_KEY" | jq '.results[].content.title'
```

The response is a paginated list of [`Content`](/content-model) wrappers — a generic envelope with a typed `oneof id` and display fields.

## 4. Acquire a stream

Stream acquisition requires an **OAuth access token with the `stream` scope** — this is the billable event. With a valid token:

```bash theme={null}
curl -sS https://sdk.anghami.com/v1/streaming/music \
  -H "Authorization: Bearer $ANGHAMI_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"song_id":{"value":"123456"},"quality":"STREAM_QUALITY_HIGH"}' | jq
```

The response carries a time-limited stream URL plus DRM metadata where applicable. Re-acquire when the URL expires.

## 5. Generate a typed client

Every release ships clients in the languages we support — pull them directly from the repo:

| Language   | Package                      |
| ---------- | ---------------------------- |
| Go         | `github.com/anghami/sdk/api` |
| TypeScript | `@anghami/sdk`               |
| Swift      | `AnghamiSDK` (SPM)           |
| Java       | `com.anghami:anghami-sdk`    |
| Python     | `anghami-sdk`                |

If you'd rather generate your own from the bundled spec:

```bash theme={null}
curl -sS https://docs.sdk.anghami.com/api/anghami-sdk.openapi.yaml -o anghami-sdk.openapi.yaml
npx @openapitools/openapi-generator-cli generate \
  -i anghami-sdk.openapi.yaml -g typescript-fetch -o ./client
```

## Next

* [Architecture](/architecture) — what the build pipeline produces and why.
* [Usage / Authentication](/usage-auth) — full OAuth + PKCE walkthrough.
* [Music Catalog](/music-catalog) — browse songs, albums, artists, lyrics.
* [Streaming & Billing](/streaming-billing) — what counts as a billable event.
