> For the complete documentation index, see [llms.txt](https://docs.squidrouter.exchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.squidrouter.exchange/api-and-sdk-integration/api/authentication.md).

# Authentication

All Squid API requests require authentication via an **integrator ID**. This page covers how to obtain credentials, use them correctly, and follow security best practices.

***

## Get Your Integrator ID

1. **Apply** via the [Integrator ID request form](https://squidrouter.typeform.com/integrator-id).
2. **Check your email** — you will receive your integrator ID shortly after applying.

{% hint style="info" %}
The integrator ID is required for all API, SDK, and widget integrations. The Squid API will reject any request without a valid integrator ID.
{% endhint %}

***

## Using Your Integrator ID

### API Requests

Include your integrator ID in the `x-integrator-id` HTTP header on every request:

```bash
curl -X POST 'https://v2.api.squidrouter.exchange/v2/route' \
  -H 'x-integrator-id: YOUR_INTEGRATOR_ID' \
  -H 'Content-Type: application/json' \
  -d '{ ... }'
```

### SDK Initialization

Pass your integrator ID when creating the Squid SDK instance:

```typescript
import { Squid } from "@0xsquid/sdk";

const squid = new Squid({
  baseUrl: "https://v2.api.squidrouter.exchange",
  integratorId: "YOUR_INTEGRATOR_ID",
});

await squid.init();
```

### Widget Configuration

Include your integrator ID in the widget configuration:

```typescript
<SquidWidget
  config={{
    integratorId: "YOUR_INTEGRATOR_ID",
    // ... other config options
  }}
/>
```

***

## Error Response

If the integrator ID is missing or invalid, the API returns:

```json
{
  "message": "x-integrator-id header is missing",
  "type": "UNAUTHORIZED"
}
```

***

## Security Best Practices

{% hint style="warning" %}
**Never expose your integrator ID in client-side code** if your ID has elevated privileges or custom rate limits. For public-facing widget integrations, the standard integrator ID is safe to include in frontend code.
{% endhint %}

* **Server-side usage**: For API integrations, make Squid API calls from your backend server, never directly from browser JavaScript.
* **Environment variables**: Store your integrator ID in environment variables (`.env`), not in source code.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.squidrouter.exchange/api-and-sdk-integration/api/authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
