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

# Authentication

> Set up your API key and make authenticated requests

## Goal

Make authenticated requests to Trio using a bearer API key.

## Base URL

All examples in these docs use:

`https://trio.machinefi.com/api`

## Step 1: Get an API Key

Create or copy your key from [console.machinefi.com](https://console.machinefi.com).

## Step 2: Send Bearer Auth

Every API request must include:

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

Example:

```bash theme={null}
curl -X POST https://trio.machinefi.com/api/streams/validate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"stream_url":"https://www.youtube.com/watch?v=jfKfPfyJRdk"}'
```

## Step 3: Verify Auth Quickly

A successful authenticated call returns normal endpoint JSON.

If auth is missing or invalid, you will receive `401` errors. See [Debugging Playbook](/guides/debugging).

## Security Practices

* Keep API keys server-side whenever possible.
* Do not commit keys to source control.
* Rotate keys if you suspect exposure.
* Use separate keys per environment (dev, staging, prod).

## Next Steps

* Run first end-to-end flow: [First Successful Workflow](/start-here/quickstart)
* Decide endpoint/mode by use case: [Choose Your Workflow](/start-here/choose-workflow)
