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

# Create customer

POST https://api-gateway.merge.dev/v1/customers
Content-Type: application/json

Reference: https://docs.merge.dev/merge-gateway/embedded-routing/customers/create-customer

## Authentication

- `Authorization` header (bearer token, required) — Your production key sent as a bearer token.

## Request

### Body (application/json)

This endpoint expects an object.

- `name` (string, required)
- `origin_id` (string, required)
- `key_usage_default` (enum, optional) — CUSTOMER_ONLY uses only the customer's own keys: never your organization's, never Merge-managed.
  - Allowed values: `USE_ANY`, `PREFER_BYOK`, `BYOK_ONLY`, `CUSTOMER_ONLY`

## Response

### 201

Successful Response

- `id` (string, optional) — Merge UUID. Use as customer at request time.
- `origin_id` (string, optional) — Your unique id for the customer (immutable).
- `name` (string, optional)
- `routing_policies` (list of string, optional) — Array of the customer's routing policy UUIDs.
- `budgets` (list of string, optional) — Array of the customer's budget UUIDs.
- `byok_configurations` (list of string, optional) — Array of the customer's provider key UUIDs.
- `key_usage_default` (enum, optional) — CUSTOMER_ONLY uses only the customer's own keys: never your organization's, never Merge-managed.
  - Allowed values: `USE_ANY`, `PREFER_BYOK`, `BYOK_ONLY`, `CUSTOMER_ONLY`
- `status` (enum, optional) — An inactive customer's requests are rejected.
  - Allowed values: `ACTIVE`, `INACTIVE`
- `created_at` (datetime, optional)
- `modified_at` (datetime, optional)

## Examples

**Request**

```json
{
  "name": "Acme",
  "origin_id": "acme-corp"
}
```

**Response**

```json
{
  "id": "9f8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
  "origin_id": "acme-corp",
  "name": "Acme",
  "routing_policies": [
    "2a1b3c4d-5e6f-4708-9a0b-1c2d3e4f5a6b"
  ],
  "budgets": [
    "7c6d5e4f-3a2b-4c1d-8e9f-0a1b2c3d4e5f"
  ],
  "byok_configurations": [
    "5e4f3a2b-1c0d-4e9f-8a7b-6c5d4e3f2a1b"
  ],
  "key_usage_default": "USE_ANY",
  "status": "ACTIVE",
  "created_at": "2026-07-01T12:00:00Z",
  "modified_at": "2026-07-01T12:00:00Z"
}
```

**SDK Code**

```python
import requests

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

payload = {
    "name": "Acme",
    "origin_id": "acme-corp"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api-gateway.merge.dev/v1/customers';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"name":"Acme","origin_id":"acme-corp"}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

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

	payload := strings.NewReader("{\n  \"name\": \"Acme\",\n  \"origin_id\": \"acme-corp\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	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/customers")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Acme\",\n  \"origin_id\": \"acme-corp\"\n}"

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.post("https://api-gateway.merge.dev/v1/customers")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Acme\",\n  \"origin_id\": \"acme-corp\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-gateway.merge.dev/v1/customers', [
  'body' => '{
  "name": "Acme",
  "origin_id": "acme-corp"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api-gateway.merge.dev/v1/customers");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Acme\",\n  \"origin_id\": \"acme-corp\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Acme",
  "origin_id": "acme-corp"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

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

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()
```