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

# Authentication

> Two bearer credentials: an API key, or an OAuth access token.

export const OutcrawlStyles = () => {
  if (typeof document !== 'undefined' && !document.getElementById('outcrawl-overrides')) {
    const s = document.createElement('style');
    s.id = 'outcrawl-overrides';
    s.textContent = `
      /* Match the product's radius grid (4 / 6 / 8 / 9999), not Mintlify's default. */
      .rounded-sm { border-radius: 0.375rem !important; } /* 6px, --r-ctl */
      .rounded-md { border-radius: 0.375rem !important; } /* 6px, --r-ctl */
      .rounded-lg { border-radius: 0.5rem !important; }   /* 8px, --r-panel */
      .rounded-l-sm { border-top-left-radius: 0.375rem !important; border-bottom-left-radius: 0.375rem !important; }
      .rounded-r-sm { border-top-right-radius: 0.375rem !important; border-bottom-right-radius: 0.375rem !important; }
      .rounded-l-md { border-top-left-radius: 0.375rem !important; border-bottom-left-radius: 0.375rem !important; }
      .rounded-r-md { border-top-right-radius: 0.375rem !important; border-bottom-right-radius: 0.375rem !important; }
      .rounded-l-lg { border-top-left-radius: 0.5rem !important; border-bottom-left-radius: 0.5rem !important; }
      .rounded-r-lg { border-top-right-radius: 0.5rem !important; border-bottom-right-radius: 0.5rem !important; }

      /* Cards: never pure white in light mode, matching the one-big-card surface tone. */
      .card { background-color: #fcfcfc !important; border-radius: 0.5rem !important; }
      html.dark .card { background-color: #141311 !important; }

      /* Docs hero box */
      .oc-hero { background-color: #fcfcfc; border: 1px solid #e5e2dc; }
      html.dark .oc-hero { background-color: #141311; border-color: #26241f; }
      html.dark .oc-hero h1 { color: #edeae4; }

      /* Thin, transparent-track, hide-until-hover scrollbar. */
      ::-webkit-scrollbar { width: 6px; height: 6px; background-color: transparent; }
      ::-webkit-scrollbar-track { background-color: transparent; }
      ::-webkit-scrollbar-thumb { background-color: rgba(155, 155, 155, 0.5); border-radius: 10px; transition: opacity 0.3s ease; opacity: 0; }
      ::-webkit-scrollbar-thumb:hover { background-color: rgba(155, 155, 155, 0.7); }
      *:hover::-webkit-scrollbar-thumb,
      *:focus::-webkit-scrollbar-thumb,
      *:active::-webkit-scrollbar-thumb { opacity: 1; }
      * { scrollbar-width: thin; scrollbar-color: rgba(155, 155, 155, 0.5) transparent; }
    `;
    document.head.appendChild(s);
  }
  return null;
};

<OutcrawlStyles />

Every request carries one bearer credential: an API key, or an OAuth access token. An API key works on `https://api.outcrawl.ai/v1` and on the MCP server alike. An OAuth token works where it was issued for: the token `outcrawl login` gets calls the API, and the token an MCP client gets calls the MCP server. This page is about the HTTP header itself; for signing in to the console, see [console authentication](/docs/account/authentication).

| | API key (`ock_...`) | OAuth access token (`oat_...`) |
| - | - | - |
| Where it comes from | Console → API keys | Signing in: `outcrawl login`, or an MCP client's first use |
| Lifetime | Long-lived, until revoked | 1 hour, refreshes for 30 days while in use |
| Best for | Your own applications, scripts, CI, anything headless | An interactive CLI or MCP client signed in as you |
| Works on | The API and the MCP server | The one it was issued for: the API (CLI) or the MCP server (MCP clients) |
| Scope | The workspace it was created in | The one workspace you picked at sign-in |
| Stops working when | You delete it in the console | It expires, you sign out (`outcrawl logout`), or you are removed from the workspace; removal cuts it off at once |

<CodeGroup>
  ```bash API key theme={"theme":{"light":"github-light","dark":"catppuccin-mocha"}}
  curl https://api.outcrawl.ai/v1/scrape \
    -H "Authorization: Bearer ock_YOUR_KEY_ID.YOUR_SECRET" \
    -H "Content-Type: application/json" \
    -d '{"url": "https://example.com"}'
  ```

  ```bash OAuth access token theme={"theme":{"light":"github-light","dark":"catppuccin-mocha"}}
  curl https://api.outcrawl.ai/v1/scrape \
    -H "Authorization: Bearer oat_..." \
    -H "Content-Type: application/json" \
    -d '{"url": "https://example.com"}'
  ```
</CodeGroup>

Both SDKs and the curl examples throughout these docs use an API key, the simplest path for code you write yourself. Use `OUTCRAWL_API_KEY` for CI and anything headless; it also takes priority over a stored CLI login, so a script always gets a predictable credential regardless of who is signed in on that machine.

## In the SDKs

Both SDKs send this header for you. Construct the client with no key and it reads `OUTCRAWL_API_KEY` from the environment; pass one in (`apiKey` in TypeScript, `api_key` in Python) and that key is used instead. With neither, the constructor throws a `TypeError` that names the variable, before any request is made.

<CodeGroup>
  ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"catppuccin-mocha"}}
  import { Outcrawl } from '@outcrawl/sdk';

  const oc = new Outcrawl(); // reads OUTCRAWL_API_KEY
  const withKey = new Outcrawl({ apiKey: 'ock_YOUR_KEY_ID.YOUR_SECRET' }); // or pass the key in
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"catppuccin-mocha"}}
  import asyncio
  from outcrawl import Outcrawl

  async def main() -> None:
      async with Outcrawl() as oc:  # reads OUTCRAWL_API_KEY
          ...

      async with Outcrawl(api_key="ock_YOUR_KEY_ID.YOUR_SECRET") as oc:  # or pass the key in
          ...

  asyncio.run(main())
  ```
</CodeGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.