Skip to content
Fresh 2026

Get an API key ​

GET https://gateway.merge.dev/v1/keys/{key_hash}

Return a single key with its current usage.

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

OpenAPI Specification ​

yaml
openapi: 3.1.0
info:
  title: gateway-management
  version: 1.0.0
paths:
  /v1/keys/{key_hash}:
    get:
      operationId: get
      summary: Get an API key
      description: Return a single key with its current usage.
      tags:
        - subpackage_keys
      parameters:
        - name: key_hash
          in: path
          description: The key's `hash` from a create or list response.
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: >-
            A management key (prefixed `mgmt_`), created in the dashboard under
            Settings, API keys, Management keys. Distinct from a regular gateway
            API key, and never used to call models.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Key'
        '401':
          description: Missing or invalid management key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Key not found in this organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
servers:
  - url: https://gateway.merge.dev
    description: https://gateway.merge.dev
components:
  schemas:
    KeyLimitReset:
      type: string
      enum:
        - daily
        - weekly
        - monthly
      description: Window the spend cap resets on. Resets at midnight UTC.
      title: KeyLimitReset
    Key:
      type: object
      properties:
        hash:
          type: string
          description: >-
            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.
        name:
          type:
            - string
            - 'null'
          description: User-set name for the key.
        label:
          type: string
          description: >-
            Display label (the key's public prefix, e.g. `mg_8Kx2pQ`). Not the
            secret.
        disabled:
          type: boolean
          description: >-
            Whether the key is disabled. A disabled key cannot call the gateway
            but is not deleted.
        limit:
          type:
            - number
            - 'null'
          format: double
          description: Spend cap in USD over the reset window. Null means no cap.
        limit_reset:
          $ref: '#/components/schemas/KeyLimitReset'
          description: Window the spend cap resets on. Resets at midnight UTC.
        usage:
          type: number
          format: double
          description: Spend in USD in the current reset window.
        limit_remaining:
          type:
            - number
            - 'null'
          format: double
          description: Remaining spend in USD before the cap. Null when no limit is set.
        created_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When the key was created.
      required:
        - hash
        - label
        - disabled
        - usage
      description: An API key with its current usage and spend limit.
      title: Key
    Error:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message.
      title: Error
  securitySchemes:
    ManagementKey:
      type: http
      scheme: bearer
      description: >-
        A management key (prefixed `mgmt_`), created in the dashboard under
        Settings, API keys, Management keys. Distinct from a regular gateway API
        key, and never used to call models.

Examples ​

Response

json
{
  "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"
}

SDK Code

python
import requests

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

headers = {"Authorization": "Bearer "}

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

print(response.json())
javascript
const url = 'https://gateway.merge.dev/v1/keys/key_hash';
const options = {method: 'GET', headers: {Authorization: 'Bearer '}};

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

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

func main() {

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

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

	req.Header.Add("Authorization", "Bearer ")

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

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

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

}
ruby
require 'uri'
require 'net/http'

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

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

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

response = http.request(request)
puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse response = Unirest.get("https://gateway.merge.dev/v1/keys/key_hash")
  .header("Authorization", "Bearer ")
  .asString();
php
request('GET', 'https://gateway.merge.dev/v1/keys/key_hash', [
  'headers' => [
    'Authorization' => 'Bearer ',
  ],
]);

echo $response->getBody();
csharp
using RestSharp;

var client = new RestClient("https://gateway.merge.dev/v1/keys/key_hash");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer ");
IRestResponse response = client.Execute(request);
swift
import Foundation

let headers = ["Authorization": "Bearer "]

let request = NSMutableURLRequest(url: NSURL(string: "https://gateway.merge.dev/v1/keys/key_hash")! 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()

Unofficial documentation reference. Built for internal use.