> 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.

# Get Credential

GET https://api-gateway.merge.dev/v1/credentials/{credential_id}

Return a provider credential. Secrets are never returned.

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

## Authentication

- `Authorization` header (bearer token, required) — A management key (`mgmt_...`), sent as `Authorization: Bearer <key>`. Reading /v1/routing-policies also accepts the organization's gateway API keys; writing there needs a management key.

## Request

### Path parameters

- `credential_id` (string, required) — The credential's `id`.

## Response

### 200

The credential

- `api_base` (string, required, nullable) — A custom base URL for the vendor's API, such as your own proxy.
- `config` (CredentialConfigV1, required) — The non-secret vendor settings. Settings that aren't set are null.
- `created_at` (datetime, required, nullable) — When the credential was created.
- `credential_hint` (string, required, nullable) — The last 4 characters of the stored API key, like `a1b2`, to tell keys apart. null when the credential has no API key, or the key is under 12 characters (4 would give away too much of it).
- `fallback_to_managed` (boolean, required) — When a request with this key fails, retry it once on Merge-managed access for the same vendor, if the organization has it.
- `id` (string, required) — The credential's id.
- `name` (string, required, nullable) — A name for the credential, shown in the dashboard.
- `updated_at` (datetime, required, nullable) — When the credential last changed.
- `vendor` (string, required) — The vendor's slug, like `openai`. Can't change after creation: delete the credential and create a new one to switch vendors. An organization has at most one credential per vendor.

## Errors

### 401 Unauthorized Error

The key is missing or invalid.

- `detail` (ErrorResponseDetail, required) — A message, or an object with a `code` to branch on and a `message`.

### 403 Forbidden Error

The key lacks the scope this route needs, or the change is not allowed.

- `detail` (ErrorResponseDetail, required) — A message, or an object with a `code` to branch on and a `message`.

### 404 Not Found Error

The resource does not exist in the key's organization.

- `detail` (ErrorResponseDetail, required) — A message, or an object with a `code` to branch on and a `message`.

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### CredentialConfigV1

Vendor-specific settings. Each field applies to the vendors named in it.

- `api_version` (string, optional, nullable) — Azure OpenAI API version.
- `aws_access_key_id` (string, optional, nullable) — Bedrock access key id.
- `aws_region` (string, optional, nullable) — Bedrock region, like `us-east-1`.
- `aws_role_arn` (string, optional, nullable) — Bedrock IAM role to assume.
- `azure_deployment` (string, optional, nullable) — Azure OpenAI deployment name.
- `vertex_location` (string, optional, nullable) — Vertex AI location.
- `vertex_project` (string, optional, nullable) — Vertex AI project id.

### ErrorResponseDetail

A message, or an object with a `code` to branch on and a `message`.

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `ctx` (ValidationErrorCtx, optional)
- `input` (any, optional)

### ErrorDetail

A structured error. Some carry extra fields, like `count`.

- `code` (string, required) — A stable code to branch on, like `payment_method_required`.
- `message` (string, required) — A human-readable explanation.

### ValidationErrorLocItems

### ValidationErrorCtx

## Examples

**Response**

```json
{
  "api_base": null,
  "config": {
    "api_version": null,
    "aws_access_key_id": null,
    "aws_region": "us-east-1",
    "aws_role_arn": "arn:aws:iam::123456789012:role/merge-gateway-bedrock",
    "azure_deployment": null,
    "vertex_location": null,
    "vertex_project": null
  },
  "created_at": "2026-06-02T17:04:00Z",
  "credential_hint": null,
  "fallback_to_managed": true,
  "id": "6d2a9f4c-3b1e-4d7a-8c5f-9e0b2a4c6d81",
  "name": "bedrock-prod",
  "updated_at": "2026-09-14T09:30:00Z",
  "vendor": "bedrock"
}
```

**SDK Code**

```python
import requests

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

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

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

print(response.json())
```

```javascript
const url = 'https://api-gateway.merge.dev/v1/credentials/credential_id';
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
package main

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

func main() {

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

	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
require 'uri'
require 'net/http'

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

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
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

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

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

$client = new \GuzzleHttp\Client();

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

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

```csharp
using RestSharp;

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

```swift
import Foundation

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

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