# Create a connector

Creates a connector.

```http
POST https://api.pozy.ai/v1/accounts/{accountId}/business-agent/connectors
```

- Area: WhatsApp / Business Agent
- Auth: Authorization: Bearer pz_live_...

## Path parameters

- `accountId` (string, required)

## Request body

Content type: `application/json`

- `name`, string, required
- `description`, string
- `base_url`, string (URL), required
- `connector_protocol`, string
- `auth_type`, string, required: One of `OAUTH2_CLIENT_CREDENTIALS`, `API_KEY`, `NONE`
- `auth_config`, object
  - `oauth2_client_credentials`, object
    - `token_url`, string (URL), required
    - `scopes_to_request`, array of string
    - `token_request_content_type`, string
    - `client_id`, string, required
    - `client_secret`, string, required
  - `api_key`, object
    - `headers`, array of object
      - `field_name`, string, required
      - `value`, string, required
      - `prefix`, string
    - `query_params`, array of object
      - `field_name`, string, required
      - `value`, string, required
      - `prefix`, string
    - `body_params`, array of object
      - `field_name`, string, required
      - `value`, string, required
      - `prefix`, string
- `user_auth_injection_config`, object
  - `location`, string, required
  - `field_name`, string, required
  - `prefix`, string
- `requires_certificate`, boolean

## Example request

```bash
curl -X POST "https://api.pozy.ai/v1/accounts/696e0b682d0a31188e7a2ba9/business-agent/connectors" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Acme",
  "base_url": "https://pozy.ai/media/example-1.jpg",
  "auth_type": "OAUTH2_CLIENT_CREDENTIALS"
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/accounts/696e0b682d0a31188e7a2ba9/business-agent/connectors", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    name: "Acme",
    base_url: "https://pozy.ai/media/example-1.jpg",
    auth_type: "OAUTH2_CLIENT_CREDENTIALS"
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.post(
    "https://api.pozy.ai/v1/accounts/696e0b682d0a31188e7a2ba9/business-agent/connectors",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "name": "Acme",
        "base_url": "https://pozy.ai/media/example-1.jpg",
        "auth_type": "OAUTH2_CLIENT_CREDENTIALS",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 201

- `name`, string, required
- `description`, string
- `base_url`, string (URL), required
- `connector_protocol`, string
- `auth_type`, string, required: One of `OAUTH2_CLIENT_CREDENTIALS`, `API_KEY`, `NONE`
- `auth_config`, object
  - `oauth2_client_credentials`, object
    - `token_url`, string (URL), required
    - `scopes_to_request`, array of string
    - `token_request_content_type`, string
    - `client_id`, string, required
    - `client_secret`, string, required
  - `api_key`, object
    - `headers`, array of object
      - `field_name`, string, required
      - `value`, string, required
      - `prefix`, string
    - `query_params`, array of object
      - `field_name`, string, required
      - `value`, string, required
      - `prefix`, string
    - `body_params`, array of object
      - `field_name`, string, required
      - `value`, string, required
      - `prefix`, string
- `user_auth_injection_config`, object
  - `location`, string, required
  - `field_name`, string, required
  - `prefix`, string
- `requires_certificate`, boolean
- `id`, string, required
- `mcp_tool_sync`, object
- `mtls_config`, object
- `connection_status`, object
  - `status`, string
  - `error_message`, string

```json
{
  "name": "Acme",
  "description": "A short description",
  "base_url": "https://pozy.ai/media/example-1.jpg",
  "connector_protocol": "string",
  "auth_type": "OAUTH2_CLIENT_CREDENTIALS",
  "auth_config": {
    "oauth2_client_credentials": {
      "token_url": "https://pozy.ai/media/example-1.jpg",
      "scopes_to_request": [
        "string"
      ],
      "token_request_content_type": "Hello from Pozy",
      "client_id": "6d8e8e36f9a9b90298b622ef",
      "client_secret": "string"
    },
    "api_key": {
      "headers": [
        {
          "field_name": "Acme",
          "value": "string",
          "prefix": "string"
        }
      ],
      "query_params": [
        {
          "field_name": "Acme",
          "value": "string",
          "prefix": "string"
        }
      ],
      "body_params": [
        {
          "field_name": "Acme",
          "value": "string",
          "prefix": "string"
        }
      ]
    }
  },
  "user_auth_injection_config": {
    "location": "string",
    "field_name": "Acme",
    "prefix": "string"
  },
  "requires_certificate": true,
  "id": "6bfebd43ddc270f6d2c56fc5",
  "mcp_tool_sync": {},
  "mtls_config": {},
  "connection_status": {
    "status": "active",
    "error_message": "Hello from Pozy"
  }
}
```
