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

# Create an endpoint

POST https://api.usepassport.ai/public/v1/namespaces/{namespaceId}/endpoints
Content-Type: application/json

`resourceGroupIds` and `secrets[].secretReferenceId` must reference resource groups / secret references that belong to this same namespace, otherwise the request returns `400`.


Reference: https://docs.usepassport.ai/api-reference/endpoints/create-endpoint

## Authentication

- `Authorization` header (bearer token, required) — WorkOS API key (Authorization: Bearer sk_...). Scope comes from the key's permissions: a key carrying `passport:admin` has admin scope (full catalog CRUD), any other key has member scope (reads + access requests). Organization-owned keys are admin by ownership and carry no associated user; keys minted for a user carry theirs, which is what access requests and `createdBy` are attributed to.

## Request

### Path parameters

- `namespaceId` (string, required)

### Headers

- `Idempotency-Key` (string, optional) — Optional idempotency key, retained 24h and bound to the request that first used it. Resending the same request replays the stored response (with `Idempotent-Replayed: true`); reusing the key with a different body or path returns 422; retrying while the original is still in flight returns 409 with `Retry-After`. A failed request releases its key.

### Body (application/json)

This endpoint expects an EndpointCreate.

- `method` (enum, required)
  - Allowed values: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `HEAD`, `OPTIONS`, `*`
- `host` (string, required) — Stored lower-cased, so the response may differ in case from the request.
- `path` (string, required) — Must start with "/". Stored as sent (case-sensitive).
- `status` (enum, optional, default: 1)
  - Allowed values: `0`, `1`
- `metadata` (map from string to any, optional, nullable) — Arbitrary JSON object, or null.
- `resourceGroupIds` (list of string, optional)
- `secrets` (list of SecretBinding, optional)

## Response

### 201

Created

- `data` (Endpoint, required)

## Errors

### 400 Bad Request Error

The endpoint body is invalid or references siblings outside its namespace.

- `error` (ErrorError, required)

### 401 Unauthorized Error

Missing or invalid API key. Unlike every other response, this one carries no `RateLimit-*` headers: the request is rejected before a key is resolved, so there is no per-key window to report. Rejection happens at the gateway, which renders this same schema (and negotiates `application/problem+json` identically).

- `error` (ErrorError, required)

### 403 Forbidden Error

Authenticated but lacking required role (e.g. member key on a catalog mutation).

- `error` (ErrorError, required)

### 404 Not Found Error

Namespace not found (or not owned by the caller's organization).

- `error` (ErrorError, required)

### 409 Conflict Error

A request with this `Idempotency-Key` is still being processed. The original is in flight; retry after `Retry-After` seconds to receive its stored response.

- `error` (ErrorError, required)

### 422 Unprocessable Entity Error

This `Idempotency-Key` was already used with a different request body or path. The first request's response is never substituted — use a new key, or resend the original request unchanged.

- `error` (ErrorError, required)

### 429 Too Many Requests Error

Rate limit exceeded.

- `error` (ErrorError, required)

### 500 Internal Server Error

Unexpected server error.

- `error` (ErrorError, required)

### 503 Service Unavailable Error

Temporary unavailability (auth dependency down, encryption-config resolution failure, or discovery document unloadable).

- `error` (ErrorError, required)

## Types

### SecretBinding

- `label` (string, required) — Display name of the slot, for example `Authorization`. It identifies the slot within its endpoint and has no effect on where a secret may be used, which is decided only by `allowedLocations`.
- `secretReferenceId` (string, optional, nullable) — null for an unmapped slot.
- `allowedLocations` (SecretBindingAllowedLocations, optional, nullable) — Where the secret reference may be substituted in a request, as a JSON object (never a string). `{"v": 1, "headers": ["x-api-key"]}` means the proxy substitutes it only in those request headers, never in the URI, query string or body. `null` means anywhere. Admin-set. `v` must be 1 and `headers` holds 1 to 16 header names; anything else returns `400`. Header names are trimmed, lower-cased, de-duplicated and sorted on write, so the response can differ from the request. Responses leave the field out when a slot has no rule. When a slot is saved without a rule, the recommended rule for a known LLM host (for example `api.anthropic.com` or `api.openai.com`) is filled in, so a response can contain a rule you did not send; send `null` to allow anywhere.

### Endpoint

- `id` (string, optional)
- `namespaceId` (string, optional)
- `method` (enum, optional)
  - Allowed values: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `HEAD`, `OPTIONS`, `*`
- `host` (string, optional)
- `path` (string, optional)
- `status` (enum, optional) — 1 = enabled, 0 = disabled.
  - Allowed values: `0`, `1`
- `metadata` (map from string to any, optional, nullable) — Arbitrary JSON object, or null.
- `secrets` (list of SecretBinding, optional)
- `resourceGroupIds` (list of string, optional)
- `createdAt` (datetime, optional)
- `updatedAt` (datetime, optional)

### ErrorError

- `code` (enum, required) — The machine-readable failure reason. Treat a value not listed here as a generic failure of the class implied by the HTTP status, and do not assume retry behaviour for it — new codes may be added.
  - Allowed values: `VALIDATION_ERROR`, `MALFORMED_JSON`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `CONFLICT`, `UNPROCESSABLE_ENTITY`, `PAYLOAD_TOO_LARGE`, `RATE_LIMITED`, `INTERNAL_ERROR`, `SERVICE_UNAVAILABLE`
- `message` (string, required)
- `details` (list of FieldError, optional)

### SecretBindingAllowedLocations

Where the secret reference may be substituted in a request, as a JSON object (never a string). `{"v": 1, "headers": ["x-api-key"]}` means the proxy substitutes it only in those request headers, never in the URI, query string or body. `null` means anywhere. Admin-set. `v` must be 1 and `headers` holds 1 to 16 header names; anything else returns `400`. Header names are trimmed, lower-cased, de-duplicated and sorted on write, so the response can differ from the request. Responses leave the field out when a slot has no rule. When a slot is saved without a rule, the recommended rule for a known LLM host (for example `api.anthropic.com` or `api.openai.com`) is filled in, so a response can contain a rule you did not send; send `null` to allow anywhere.

- `v` (enum, required)
  - Allowed values: `1`
- `headers` (list of string, required)

### FieldError

- `field` (string, optional)
- `message` (string, optional)

## Examples

### created

**Response**

```json
{
  "data": {
    "id": "9e0f1a2b-3c4d-5e6f-7a8b-9c0d1e2f3a4b",
    "namespaceId": "3f7c2b6e-1c2d-4a5b-9e8f-0a1b2c3d4e5f",
    "method": "POST",
    "host": "api.stripe.com",
    "path": "/v1/charges",
    "status": 1,
    "metadata": {
      "description": "Create a charge"
    },
    "secrets": [
      {
        "label": "Authorization",
        "secretReferenceId": "5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f"
      }
    ],
    "resourceGroupIds": [
      "8a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d"
    ],
    "createdAt": "2026-09-03T06:12:00.000Z",
    "updatedAt": "2026-09-03T06:12:00.000Z"
  }
}
```

**SDK Code**

```python created
import requests

url = "https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints"

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

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

print(response.json())
```

```javascript created
const url = 'https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints';
const options = {method: 'POST', 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 created
package main

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

func main() {

	url := "https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints"

	req, _ := http.NewRequest("POST", 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 created
require 'uri'
require 'net/http'

url = URI("https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints")

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

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

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

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

HttpResponse<String> response = Unirest.post("https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp created
using RestSharp;

var client = new RestClient("https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift created
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```

### default

**Request**

```json
{
  "method": "POST",
  "host": "api.stripe.com",
  "path": "/v1/charges",
  "status": 1,
  "metadata": {
    "description": "Create a charge"
  },
  "resourceGroupIds": [
    "8a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d"
  ],
  "secrets": [
    {
      "label": "Authorization",
      "secretReferenceId": "5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f"
    }
  ]
}
```

**Response**

```json
{
  "data": {
    "id": "9e0f1a2b-3c4d-5e6f-7a8b-9c0d1e2f3a4b",
    "namespaceId": "3f7c2b6e-1c2d-4a5b-9e8f-0a1b2c3d4e5f",
    "method": "POST",
    "host": "api.stripe.com",
    "path": "/v1/charges",
    "status": 1,
    "metadata": {
      "description": "Create a charge"
    },
    "secrets": [
      {
        "label": "Authorization",
        "secretReferenceId": "5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f"
      }
    ],
    "resourceGroupIds": [
      "8a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d"
    ],
    "createdAt": "2026-09-03T06:12:00.000Z",
    "updatedAt": "2026-09-03T06:12:00.000Z"
  }
}
```

**SDK Code**

```python default
import requests

url = "https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints"

payload = {
    "method": "POST",
    "host": "api.stripe.com",
    "path": "/v1/charges",
    "status": 1,
    "metadata": { "description": "Create a charge" },
    "resourceGroupIds": ["8a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d"],
    "secrets": [
        {
            "label": "Authorization",
            "secretReferenceId": "5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f"
        }
    ]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript default
const url = 'https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"method":"POST","host":"api.stripe.com","path":"/v1/charges","status":1,"metadata":{"description":"Create a charge"},"resourceGroupIds":["8a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d"],"secrets":[{"label":"Authorization","secretReferenceId":"5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f"}]}'
};

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

```go default
package main

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

func main() {

	url := "https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints"

	payload := strings.NewReader("{\n  \"method\": \"POST\",\n  \"host\": \"api.stripe.com\",\n  \"path\": \"/v1/charges\",\n  \"status\": 1,\n  \"metadata\": {\n    \"description\": \"Create a charge\"\n  },\n  \"resourceGroupIds\": [\n    \"8a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d\"\n  ],\n  \"secrets\": [\n    {\n      \"label\": \"Authorization\",\n      \"secretReferenceId\": \"5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f\"\n    }\n  ]\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 default
require 'uri'
require 'net/http'

url = URI("https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints")

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  \"method\": \"POST\",\n  \"host\": \"api.stripe.com\",\n  \"path\": \"/v1/charges\",\n  \"status\": 1,\n  \"metadata\": {\n    \"description\": \"Create a charge\"\n  },\n  \"resourceGroupIds\": [\n    \"8a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d\"\n  ],\n  \"secrets\": [\n    {\n      \"label\": \"Authorization\",\n      \"secretReferenceId\": \"5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f\"\n    }\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"method\": \"POST\",\n  \"host\": \"api.stripe.com\",\n  \"path\": \"/v1/charges\",\n  \"status\": 1,\n  \"metadata\": {\n    \"description\": \"Create a charge\"\n  },\n  \"resourceGroupIds\": [\n    \"8a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d\"\n  ],\n  \"secrets\": [\n    {\n      \"label\": \"Authorization\",\n      \"secretReferenceId\": \"5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f\"\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints', [
  'body' => '{
  "method": "POST",
  "host": "api.stripe.com",
  "path": "/v1/charges",
  "status": 1,
  "metadata": {
    "description": "Create a charge"
  },
  "resourceGroupIds": [
    "8a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d"
  ],
  "secrets": [
    {
      "label": "Authorization",
      "secretReferenceId": "5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f"
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp default
using RestSharp;

var client = new RestClient("https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"method\": \"POST\",\n  \"host\": \"api.stripe.com\",\n  \"path\": \"/v1/charges\",\n  \"status\": 1,\n  \"metadata\": {\n    \"description\": \"Create a charge\"\n  },\n  \"resourceGroupIds\": [\n    \"8a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d\"\n  ],\n  \"secrets\": [\n    {\n      \"label\": \"Authorization\",\n      \"secretReferenceId\": \"5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift default
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "method": "POST",
  "host": "api.stripe.com",
  "path": "/v1/charges",
  "status": 1,
  "metadata": ["description": "Create a charge"],
  "resourceGroupIds": ["8a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d"],
  "secrets": [
    [
      "label": "Authorization",
      "secretReferenceId": "5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f"
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints")! 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()
```

### Limit a secret to specific headers

**Request**

```json
{
  "method": "POST",
  "host": "api.example.com",
  "path": "/v1/charges",
  "secrets": [
    {
      "label": "Authorization",
      "secretReferenceId": "5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f",
      "allowedLocations": {
        "v": 1,
        "headers": [
          "authorization",
          "x-api-key"
        ]
      }
    }
  ]
}
```

**Response**

```json
{
  "data": {
    "id": "9e0f1a2b-3c4d-5e6f-7a8b-9c0d1e2f3a4b",
    "namespaceId": "3f7c2b6e-1c2d-4a5b-9e8f-0a1b2c3d4e5f",
    "method": "POST",
    "host": "api.stripe.com",
    "path": "/v1/charges",
    "status": 1,
    "metadata": {
      "description": "Create a charge"
    },
    "secrets": [
      {
        "label": "Authorization",
        "secretReferenceId": "5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f"
      }
    ],
    "resourceGroupIds": [
      "8a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d"
    ],
    "createdAt": "2026-09-03T06:12:00.000Z",
    "updatedAt": "2026-09-03T06:12:00.000Z"
  }
}
```

**SDK Code**

```python Limit a secret to specific headers
import requests

url = "https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints"

payload = {
    "method": "POST",
    "host": "api.example.com",
    "path": "/v1/charges",
    "secrets": [
        {
            "label": "Authorization",
            "secretReferenceId": "5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f",
            "allowedLocations": {
                "v": 1,
                "headers": ["authorization", "x-api-key"]
            }
        }
    ]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Limit a secret to specific headers
const url = 'https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"method":"POST","host":"api.example.com","path":"/v1/charges","secrets":[{"label":"Authorization","secretReferenceId":"5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f","allowedLocations":{"v":1,"headers":["authorization","x-api-key"]}}]}'
};

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

```go Limit a secret to specific headers
package main

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

func main() {

	url := "https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints"

	payload := strings.NewReader("{\n  \"method\": \"POST\",\n  \"host\": \"api.example.com\",\n  \"path\": \"/v1/charges\",\n  \"secrets\": [\n    {\n      \"label\": \"Authorization\",\n      \"secretReferenceId\": \"5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f\",\n      \"allowedLocations\": {\n        \"v\": 1,\n        \"headers\": [\n          \"authorization\",\n          \"x-api-key\"\n        ]\n      }\n    }\n  ]\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 Limit a secret to specific headers
require 'uri'
require 'net/http'

url = URI("https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints")

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  \"method\": \"POST\",\n  \"host\": \"api.example.com\",\n  \"path\": \"/v1/charges\",\n  \"secrets\": [\n    {\n      \"label\": \"Authorization\",\n      \"secretReferenceId\": \"5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f\",\n      \"allowedLocations\": {\n        \"v\": 1,\n        \"headers\": [\n          \"authorization\",\n          \"x-api-key\"\n        ]\n      }\n    }\n  ]\n}"

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

```java Limit a secret to specific headers
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"method\": \"POST\",\n  \"host\": \"api.example.com\",\n  \"path\": \"/v1/charges\",\n  \"secrets\": [\n    {\n      \"label\": \"Authorization\",\n      \"secretReferenceId\": \"5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f\",\n      \"allowedLocations\": {\n        \"v\": 1,\n        \"headers\": [\n          \"authorization\",\n          \"x-api-key\"\n        ]\n      }\n    }\n  ]\n}")
  .asString();
```

```php Limit a secret to specific headers
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints', [
  'body' => '{
  "method": "POST",
  "host": "api.example.com",
  "path": "/v1/charges",
  "secrets": [
    {
      "label": "Authorization",
      "secretReferenceId": "5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f",
      "allowedLocations": {
        "v": 1,
        "headers": [
          "authorization",
          "x-api-key"
        ]
      }
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Limit a secret to specific headers
using RestSharp;

var client = new RestClient("https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"method\": \"POST\",\n  \"host\": \"api.example.com\",\n  \"path\": \"/v1/charges\",\n  \"secrets\": [\n    {\n      \"label\": \"Authorization\",\n      \"secretReferenceId\": \"5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f\",\n      \"allowedLocations\": {\n        \"v\": 1,\n        \"headers\": [\n          \"authorization\",\n          \"x-api-key\"\n        ]\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Limit a secret to specific headers
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "method": "POST",
  "host": "api.example.com",
  "path": "/v1/charges",
  "secrets": [
    [
      "label": "Authorization",
      "secretReferenceId": "5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f",
      "allowedLocations": [
        "v": 1,
        "headers": ["authorization", "x-api-key"]
      ]
    ]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.usepassport.ai/public/v1/namespaces/namespaceId/endpoints")! 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()
```