> This page is for Gateway.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.merge.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.merge.dev/_mcp/server.

# List API keys

GET https://api-gateway.merge.dev/v1/keys

Return the organization's API keys with their current usage, wrapped in a list envelope. The management key's organization is implied by the key itself. A page holds at most 100 keys; when has_more is true, advance offset to read the rest.

Reference: https://docs.merge.dev/merge-gateway/management-api/api-keys/list

## Authentication

- `Authorization` header (bearer token, required) — A management key (prefixed `mgmt_`), created on the dashboard's **API keys** page under **Management keys**. Distinct from a regular gateway API key, and never used to call models.

## Request

### Query parameters

- `offset` (integer, optional, default: 0) — Number of keys to skip.
- `limit` (integer, optional, default: 100) — Maximum number of keys to return (max 100).

## Response

### 200

A page of the organization's keys.

- `object` ("list", optional)
- `data` (list of Key, optional)
- `has_more` (boolean, optional) — True when more keys remain beyond this page. Advance with offset until it is false.

## Errors

### 401 Unauthorized Error

Missing or invalid management key.

- `detail` (string, optional) — Human-readable error message.

## Types

### Key

An API key with its current usage and spend limit.

- `hash` (string, required) — Stable identifier for the key. A one-way hash, not the secret, so it is safe to store and log. Use it in get, update, and delete calls.
- `label` (string, required) — Display label (the key's public prefix, e.g. `mg_8Kx2pQ`). Not the secret.
- `disabled` (boolean, required) — Whether the key is disabled. A disabled key cannot call the gateway but is not deleted.
- `usage` (double, required) — Spend in USD in the current reset window.
- `name` (string, optional, nullable) — User-set name for the key.
- `limit` (double, optional, nullable) — Spend cap in USD over the reset window. Null means no cap.
- `limit_reset` (enum, optional) — Window the spend cap resets on. Resets at midnight UTC.
  - Allowed values: `daily`, `weekly`, `monthly`
- `limit_remaining` (double, optional, nullable) — Remaining spend in USD before the cap. Null when no limit is set.
- `created_at` (datetime, optional, nullable) — When the key was created.
- `project_id` (string, optional, nullable) — Project the key is scoped to, or null for an organization-wide key.
- `allowed_models` (list of string, optional, nullable) — Models the key may call; null means unrestricted and an empty list blocks every model.
- `routing_policy_id` (string, optional, nullable) — Routing policy bound to the key, if any.

## Examples

**Response**

```json
{
  "object": "list",
  "data": [
    {
      "hash": "a1b2c3d4e5f6",
      "label": "mg_8Kx2pQ",
      "disabled": false,
      "usage": 12.4,
      "name": "customer-acme",
      "limit": 50,
      "limit_reset": "monthly",
      "limit_remaining": 37.6,
      "created_at": "2026-06-02T17:04:00Z",
      "project_id": null,
      "allowed_models": null,
      "routing_policy_id": null
    }
  ],
  "has_more": false
}
```

**SDK Code**

```python keys_list_example
import requests

url = "https://api-gateway.merge.dev/v1/keys"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript keys_list_example
const url = 'https://api-gateway.merge.dev/v1/keys';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go keys_list_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api-gateway.merge.dev/v1/keys"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby keys_list_example
require 'uri'
require 'net/http'

url = URI("https://api-gateway.merge.dev/v1/keys")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java keys_list_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api-gateway.merge.dev/v1/keys")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php keys_list_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api-gateway.merge.dev/v1/keys', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp keys_list_example
using RestSharp;

var client = new RestClient("https://api-gateway.merge.dev/v1/keys");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift keys_list_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api-gateway.merge.dev/v1/keys")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```