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

# 認証

> APIキーを使用してOlostepの検索、スクレイピング、およびクロールAPIに認証します。

APIエンドポイントは、APIトークンを使用して認証する必要があります。

## トークンを生成する

トークンはOlostepダッシュボードから生成できます。アカウントを[こちら](https://www.olostep.com/auth/)で作成してください。

## トークンを使用する

すべてのHTTP呼び出しに`Authorization`ヘッダーを追加することで認証できます。Authorizationヘッダーは次のようにフォーマットされます: `Authorization: Bearer <API-TOKEN>`（`<API-TOKEN>`をあなたのトークンに置き換えてください。トークンがない場合は、Olostepの[ダッシュボード](https://www.olostep.com/dashboard/)から無料で生成できます）。

例:

<CodeGroup>
  ```python Python theme={null}
  # pip install requests

  import requests

  endpoint = 'https://api.olostep.com/v1/scrapes/<SCRAPE_ID>'
  headers = {
      'Authorization': 'Bearer <API-TOKEN>',
      'Accept': 'application/json'
  }

  response = requests.get(endpoint, headers=headers)
  print(response.status_code)
  print(response.json())
  ```

  ```js Node theme={null}
  // npm install node-fetch

  // ESM
  import fetch from 'node-fetch'

  const endpoint = 'https://api.olostep.com/v1/scrapes/<SCRAPE_ID>'
  const res = await fetch(endpoint, {
    headers: {
      'Authorization': 'Bearer <API-TOKEN>',
      'Accept': 'application/json'
    }
  })
  console.log(res.status)
  console.log(await res.json())
  ```

  ```bash cURL theme={null}
  curl -L -X GET 'https://api.olostep.com/v1/scrapes/<SCRAPE_ID>' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer <API-TOKEN>'
  ```
</CodeGroup>

## CLIを使用する

[Olostep CLI](/sdks/cli)を使用している場合、手動でキーを扱う必要はなく、ターミナルからサインインできます:

```bash theme={null}
npm install -g olostep-cli
olostep login
```

ブラウザが開き、**Authorize**をクリックすると、キーがローカルに保存されます。CIの場合は、`OLOSTEP_API_KEY`を設定してください。

## SDKを使用する

[Python](/sdks/python)および[Node.js](/sdks/node-js) SDKは、環境から`OLOSTEP_API_KEY`を読み取るか、クライアントを構築する際にキーを直接受け取ります。
