> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anchorbrowser.io/llms.txt
> Use this file to discover all available pages before exploring further.

# CA Certificates

> Install custom CA certificates to trust internal services and private PKI in browser sessions.

## Common use cases

| Use case                     | Description                                                                                 |
| ---------------------------- | ------------------------------------------------------------------------------------------- |
| **Internal services**        | Access private dashboards and endpoints using certificates signed by your organization's CA |
| **Dev/staging environments** | Connect to environments with self-signed or private CA certificates                         |
| **mTLS authentication**      | Validate server certificate chains in mutual TLS setups                                     |
| **QA/testing**               | Run automated tests with temporary CAs or simulated certificate chains                      |
| **Enterprise networks**      | Support environments with custom trust policies or air-gapped infrastructure                |

## Managing certificates

Certificates are managed at the team level. Upload a certificate once, then reference it by name in any session.

### Upload a certificate

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.anchorbrowser.io/v1/certificates \
    -H "anchor-api-key: YOUR_API_KEY" \
    -F "file=@/path/to/your-ca.crt" \
    -F "name=my-internal-ca" \
    -F "description=CA for internal services"
  ```

  ```python python theme={null}
  import requests
  import os

  with open("/path/to/your-ca.crt", "rb") as f:
      response = requests.post(
          "https://api.anchorbrowser.io/v1/certificates",
          headers={"anchor-api-key": os.getenv("ANCHOR_API_KEY")},
          files={"file": f},
          data={
              "name": "my-internal-ca",
              "description": "CA for internal services"
          }
      )
  ```

  ```javascript node.js theme={null}
  import fs from 'fs';

  const formData = new FormData();
  const certContent = fs.readFileSync('/path/to/your-ca.crt');
  formData.append('file', new Blob([certContent]), 'your-ca.crt');
  formData.append('name', 'my-internal-ca');
  formData.append('description', 'CA for internal services');

  const response = await fetch('https://api.anchorbrowser.io/v1/certificates', {
    method: 'POST',
    headers: { 'anchor-api-key': process.env.ANCHOR_API_KEY },
    body: formData
  });
  const certificate = await response.json();
  console.log('Certificate uploaded:', certificate);
  ```
</CodeGroup>

| Parameter     | Required | Description                                            |
| ------------- | -------- | ------------------------------------------------------ |
| `file`        | Yes      | Certificate file (`.crt`, `.pem`, `.cer`, `.der`)      |
| `name`        | Yes      | Unique identifier (alphanumeric, hyphens, underscores) |
| `description` | No       | Optional description (max 1000 characters)             |

### List certificates

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.anchorbrowser.io/v1/certificates \
    -H "anchor-api-key: YOUR_API_KEY"
  ```

  ```python python theme={null}
  import requests
  import os

  response = requests.get(
      "https://api.anchorbrowser.io/v1/certificates",
      headers={"anchor-api-key": os.getenv("ANCHOR_API_KEY")}
  )
  print("Certificates:", response.json())
  ```

  ```javascript node.js theme={null}
  const response = await fetch('https://api.anchorbrowser.io/v1/certificates', {
    headers: { 'anchor-api-key': process.env.ANCHOR_API_KEY }
  });
  const certificates = await response.json();
  console.log('Certificates:', certificates);
  ```
</CodeGroup>

### Delete a certificate

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE https://api.anchorbrowser.io/v1/certificates/my-internal-ca \
    -H "anchor-api-key: YOUR_API_KEY"
  ```

  ```python python theme={null}
  import requests
  import os

  response = requests.delete(
      "https://api.anchorbrowser.io/v1/certificates/my-internal-ca",
      headers={"anchor-api-key": os.getenv("ANCHOR_API_KEY")}
  )
  print("Deleted:", response.json())
  ```

  ```javascript node.js theme={null}
  const response = await fetch('https://api.anchorbrowser.io/v1/certificates/my-internal-ca', {
    method: 'DELETE',
    headers: { 'anchor-api-key': process.env.ANCHOR_API_KEY }
  });
  console.log('Deleted:', await response.json());
  ```
</CodeGroup>

## Using a certificate

After uploading a certificate, reference it by name when creating a session:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.anchorbrowser.io/v1/sessions \
    -H "anchor-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "browser": {
        "ca_cert": {
          "active": true,
          "name": "my-internal-ca"
        }
      }
    }'
  ```

  ```python python theme={null}
  import requests
  import os

  response = requests.post(
      "https://api.anchorbrowser.io/v1/sessions",
      headers={
          "anchor-api-key": os.getenv("ANCHOR_API_KEY"),
          "Content-Type": "application/json"
      },
      json={
          "browser": {
              "ca_cert": {
                  "active": True,
                  "name": "my-internal-ca"
              }
          }
      }
  )
  print("Session:", response.json())
  ```

  ```javascript node.js theme={null}
  const response = await fetch('https://api.anchorbrowser.io/v1/sessions', {
    method: 'POST',
    headers: {
      'anchor-api-key': process.env.ANCHOR_API_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      browser: {
        ca_cert: {
          active: true,
          name: 'my-internal-ca'
        }
      }
    })
  });
  const session = await response.json();
  console.log('Session:', session);
  ```
</CodeGroup>

## Related capabilities

<CardGroup cols={2}>
  <Card title="Proxy" icon="globe" href="/advanced/proxy">
    Route traffic through proxies for network control.
  </Card>

  <Card title="Authentication" icon="id-card" href="/essentials/authenticated-applications">
    Persistent identity for seamless access to applications.
  </Card>
</CardGroup>
