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

# Call an API with Passport

As a Passport Member, you can send authenticated API requests using secret references instead of real secrets. This page covers how to send requests from the Passport CLI and external clients like curl and scripts.

To learn more about Passport roles, see [Passport roles](/passport/get-started/basics/concepts/#passport-roles).

## Prerequisites

Before you begin, make sure you have the following:

* A Passport Admin must approve your [access request](/passport/use/request-api-access/).
* You must have [connected to the proxy](/passport/use/connect-to-proxy/) from your computer.

## Copy a secret reference

Your requests use a secret reference token (`{{vault:<id>}}`) in place of the real secret. You can view every resource you can reach and when your access expires.

To copy a secret reference, do the following:

1. In the left sidebar, select **My access**.
2. Find the resource and expand its row to see its secret references.
3. Click **Copy** next to a reference to copy its `{{vault:<id>}}` token.

Passport copies the reference token, never the secret itself.

## Send a request from the Passport CLI

You can send requests directly using the Passport CLI. The Passport CLI handles mTLS directly, so no daemon is required. Use the secret reference name wherever the API requires a secret. This is the name the Admin set when mapping the secret reference, not the environment variable name. For all request options, see [Request command](/passport/reference/passport-cli/request/).

For example, if the Passport Admin mapped the secret reference `POSTMAN_API_KEY` to the `api_key` environment variable, use `{{vault:POSTMAN_API_KEY}}` in your request.

```sh showLineNumbers={false}
passport request "https://api.example.com/data" \
  -H "x-api-key: {{vault:POSTMAN_API_KEY}}"
```

Requests you send this way always route through the Passport Proxy. The [intercept and bypass rules](/passport/reference/passport-cli/routing/) that apply to external clients don't affect them.

## Send a request from an external client

External clients like curl and scripts route requests through the local daemon at `localhost:10144`. Before sending requests, choose which traffic the daemon routes through the proxy. Then use the secret reference name wherever the API requires a secret. This is the name the Admin set when mapping the secret reference, not the environment variable name. The daemon resolves it at request time.

### Configure routing

The `passport setup` command creates `~/.passport/daemon.yml` with a catch-all intercept rule (`intercept: ["*"]`), so every host routes through the proxy by default. Higher-priority bypass rules, such as Passport's own backend hosts, still connect directly.

To change what the daemon routes, use the [`passport intercept` and `passport bypass` commands](/passport/reference/passport-cli/routing/):

* `passport intercept add <pattern>` adds a local rule to route a host through the proxy. `passport intercept remove <pattern>` removes that local rule.
* `passport bypass add <pattern>` adds a local rule to send a host straight to its origin, skipping the proxy. `passport bypass remove <pattern>` removes that local rule.
* `passport intercept list` and `passport bypass list` show the rules in effect.

For example, to send one host straight to its origin instead of through the proxy:

```bash showLineNumbers={false}
passport bypass add "internal.example.com"
```

The commands write `~/.passport/daemon.yml`, which uses two pattern lists:

```yaml showLineNumbers={false}
version: 2
intercept:
  - "*"
bypass: []
```

`intercept` patterns route through the proxy. `bypass` patterns connect directly. A host that matches no rule connects directly. Patterns are exact hosts or leading wildcards (`api.example.com`, `*.example.com`), up to 256 per list. Changes are picked up automatically without restarting the daemon.

> **Info**
>
> A Passport bypass rule is not the same as `NO_PROXY`. A client that respects `HTTPS_PROXY` still sends a bypassed request to the local daemon, which then connects directly to the origin instead of routing through the Passport Proxy. `NO_PROXY` prevents the request from reaching the daemon at all. See [Configuration notes](#configuration-notes).

### Examples

With the `daemon.yml` file configured, use secret references wherever the API requires a secret. Secret references resolve in request headers and the URL.

**curl:**

```sh showLineNumbers={false}
curl "https://api.example.com/data" \
  -H "Authorization: Bearer {{vault:API_KEY}}"
```

```sh showLineNumbers={false}
# Header
curl -H "x-api-key: {{vault:API_KEY}}" https://api.example.com/data

# URL path
curl https://api.example.com/v1/{{vault:ACCOUNT_ID}}/transactions

# Query parameter
curl "https://api.example.com/search?token={{vault:ACCESS_TOKEN}}"
```

**Node.js / TypeScript:**

```typescript showLineNumbers={false}
const response = await fetch("https://api.example.com/data", {
  headers: { "x-api-key": "{{vault:API_KEY}}" },
});
console.log(await response.json());
```

If `fetch` isn't picking up the proxy, run your script with `node --use-env-proxy your-script.js`.

### Configuration notes

If your HTTP client doesn't respect `HTTPS_PROXY` or `SSL_CERT_FILE`, configure it manually to use `http://127.0.0.1:10144` as the HTTPS proxy and trust the CA at `~/.passport/ca.pem`.

Setup sets `NO_PROXY` to exclude Passport's own backend domains (`localhost`, `.postman.com`, `.getpostman.com`, `.pstmn.io`, and others) so the daemon doesn't loop its own backend calls through itself. If the API you're testing is on an excluded domain, the request bypasses the proxy silently. To override this for a single request, clear `NO_PROXY` inline:

```sh showLineNumbers={false}
NO_PROXY="" curl "https://api.example.com/collections" \
  -H "x-api-key: {{vault:COLLECTIONS_API_KEY}}"
```

To override it permanently for a specific domain, remove that domain from `NO_PROXY` in your shell profile.