Skip to content

Commit 6ffc124

Browse files
claudespicelukekim
authored andcommitted
docs: Document Authorization: Bearer header for HTTP API auth
HTTP routes now accept the API key in either `X-API-Key` or `Authorization: Bearer ${api_key}`. The Bearer scheme matching is case-insensitive. When both headers are present `X-API-Key` takes precedence. Source: spiceai/spiceai#10911
1 parent 10d5d9f commit 6ffc124

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

website/docs/api/auth/index.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ The API key authentication is applied on startup and changes will not take effec
3636
3737
## HTTP
3838
39-
For HTTP routes, the API key is expected to be included in the `X-API-Key` header.
39+
For HTTP routes, the API key can be supplied in either the `X-API-Key` header or the `Authorization: Bearer ${ api_key }` header. The `Bearer` scheme is matched case-insensitively. If both headers are present, `X-API-Key` takes precedence.
4040

4141
```bash
4242
> curl -i "http://localhost:8090/v1/sql" -H "X-API-Key: 1234567890" -d 'SELECT 1'
@@ -50,6 +50,12 @@ date: Fri, 08 Nov 2024 07:14:24 GMT
5050
[{"Int64(1)":1}]
5151
```
5252

53+
Or using `Authorization: Bearer`:
54+
55+
```bash
56+
> curl -i "http://localhost:8090/v1/sql" -H "Authorization: Bearer 1234567890" -d 'SELECT 1'
57+
```
58+
5359
The `/health` and `/v1/ready` endpoints are not protected and can be accessed without an API key.
5460

5561
## Flight SQL

0 commit comments

Comments
 (0)