# Register a tunnel connector; the callback HMAC secret is returned once

POST /api/agent/connectors. Required scopes: connectors:write.

HTML: https://notify.belweave.ai/docs/api/postConnectors

Required scopes: `connectors:write`

```http
POST /api/agent/connectors
Authorization: Bearer ntf_your_token
```

## Operation schema

```json
{
  "summary": "Register a tunnel connector; the callback HMAC secret is returned once",
  "operationId": "postConnectors",
  "security": [
    {
      "bearer": [
        "connectors:write"
      ]
    }
  ],
  "x-notify-scopes": [
    "connectors:write"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            },
            "tunnelId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[a-z0-9]+$"
            },
            "hostname": {
              "type": "string",
              "minLength": 1,
              "maxLength": 253
            },
            "routes": {
              "maxItems": 32,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "pattern": "^(@|[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)$"
                  },
                  "target": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "^[A-Za-z0-9._[\\]:-]+:\\d{1,5}$"
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "format": "uri"
                  },
                  "appId": {
                    "type": "string",
                    "pattern": "^app_[A-Za-z0-9_-]{8,64}$"
                  },
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name",
                  "target",
                  "url"
                ]
              }
            },
            "teamId": {
              "type": "string",
              "pattern": "^team_[A-Za-z0-9_-]{8,64}$",
              "description": "Team or free Family ID (team_…) returned by teams_create or teams_list"
            },
            "oncallGroupId": {
              "type": "string",
              "pattern": "^ocg_[A-Za-z0-9_-]{8,64}$"
            }
          },
          "required": [
            "name",
            "tunnelId",
            "hostname"
          ]
        }
      }
    }
  },
  "responses": {
    "201": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ConnectorCreated"
          }
        }
      }
    },
    "400": {
      "description": "Invalid request",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Missing, unknown, revoked, or expired token",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "The token lacks a required scope or the account lacks permission",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Not found for this account",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
```

Resolve schema references against [OpenAPI](https://notify.belweave.ai/openapi.json).
