Skip to content
HookDeploy
On this page

Destinations API

Manage saved HTTPS destinations in your organization library, create agent forward destinations on endpoints, and list forward destinations configured on a webhook endpoint.

HookDeploy has two destination layers:

  • Saved destinations (library) — reusable HTTPS URL templates at the organization level (/v1/destinations). Agent targets cannot be saved or reused; they are endpoint-specific forward destinations only.
  • Forward destinations — per-endpoint targets used at forward time (/v1/endpoints/:id/destinations). Each forward destination is either HTTPS (destination_type: "https") or agent (destination_type: "agent"), never both.

Creating saved destinations or HTTPS forward attachments requires an API key whose role has endpoints.edit (typically super_admin, admin, or developer). Creating agent forward destinations additionally requires agents.assign_destination on the same roles (viewer cannot assign agents).

Destination types (stored shape)

Typedestination_typeRequired fieldsNotes
HTTPS"https"url (https://…)agent_id, target_port, target_path are always null
Agent"agent"agent_id, target_port (1–65535), target_path (must start with /)url is always null. No host is stored — only loopback port and path on the enrolled machine. Optional environment_override: "development" only (downgrade-only; inherits agent environment when omitted).

Agent destinations dial out through an enrolled HookDeploy agent. The agent must belong to the same organization as the endpoint.


Create destination

POST /v1/destinations

Behavior depends on destination_type. When omitted, it defaults to https (saved-destination flow).

HTTPS saved destination (default)

Creates a reusable saved destination. If endpoint_id is present, also attaches it as an HTTPS forward destination on that endpoint.

curl -s -X POST \
  "https://api.hookdeploy.dev/v1/destinations" \
  -H "Authorization: Bearer hd_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production Webhook",
    "url": "https://myserver.com/webhooks",
    "endpoint_id": "550e8400-e29b-41d4-a716-446655440000"
  }'

Body fields (HTTPS / saved):

FieldRequiredDescription
nameyesDisplay name
urlyesTarget URL (https://…)
destination_typenoOmit or "https"
endpoint_idnoIf set, also creates a forward destination on that endpoint
visibilitynoprivate, org, or restricted
is_reusablenoBoolean (defaults to reusable library entry)

Success (201) — saved destination shape:

{
  "data": {
    "id": "990e8400-e29b-41d4-a716-446655440004",
    "name": "Production Webhook",
    "url": "https://myserver.com/webhooks",
    "visibility": "private",
    "is_reusable": true,
    "created_at": "2026-05-24T12:00:00Z",
    "forward_destination_id": "aa0e8400-e29b-41d4-a716-446655440005"
  }
}

If endpoint_id is provided and the attach step fails, the saved destination is still created. The response remains HTTP 201 with data plus an attachment_error object (code + message) at the top level — not inside data. Retry attach from the dashboard or a later API call as needed.

Agent forward destination

Creates a forward destination directly on an endpoint. There is no saved-destination record — agent targets are not reusable templates.

Requires agents.assign_destination on the API key’s role.

curl -s -X POST \
  "https://api.hookdeploy.dev/v1/destinations" \
  -H "Authorization: Bearer hd_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Local API",
    "destination_type": "agent",
    "endpoint_id": "550e8400-e29b-41d4-a716-446655440000",
    "agent_id": "660e8400-e29b-41d4-a716-446655440001",
    "target_port": 3000,
    "target_path": "/webhooks/hookdeploy"
  }'

Body fields (agent):

FieldRequiredDescription
nameyesDisplay name
destination_typeyesMust be "agent"
endpoint_idyesEndpoint to attach the forward destination to
agent_idyesUUID of an enrolled agent in your organization
target_portyesInteger 1–65535 (loopback port on the agent machine)
target_pathyesPath starting with / (e.g. /webhooks/hookdeploy)
environment_overrideno"development" only — optional downgrade for this destination

Do not send url, visibility, or is_reusable for agent creates — saved-destination fields do not apply.

Success (201) — forward destination shape:

{
  "data": {
    "id": "aa0e8400-e29b-41d4-a716-446655440005",
    "name": "Local API",
    "destination_type": "agent",
    "agent_id": "660e8400-e29b-41d4-a716-446655440001",
    "target_port": 3000,
    "target_path": "/webhooks/hookdeploy",
    "url": null,
    "enabled": true,
    "created_at": "2026-05-24T12:00:00Z",
    "environment_override": null
  }
}

Agent create errors (returned as top-level error, not attachment_error):

HTTPCodeWhen
400missing_fieldendpoint_id, agent_id, target_port, or target_path absent
400bad_requestPort outside 1–65535, path not starting with /, agent not found in your org, invalid environment_override, or other validation failure
401unauthorizedInvalid API key
403forbiddenRole lacks agents.assign_destination or endpoints.edit, endpoint not visible, or RPC permission denied
403plan_limitForward destination limit reached for this endpoint (per-plan max_forward_destinations)
404not_foundEndpoint not found or not visible to this API key

Production agent enrollment limits (max_agents) are enforced when enrolling or marking agents production — not when assigning an existing agent to a destination. This endpoint does not return agent-count usage.


List saved destinations

GET /v1/destinations

Returns HTTPS saved destinations only. Agent forward destinations never appear here.

curl -s "https://api.hookdeploy.dev/v1/destinations?limit=25" \
  -H "Authorization: Bearer hd_live_YOUR_KEY"

Query parameters: limit (default 25, max 100), before (cursor).

Response:

{
  "data": {
    "data": [
      {
        "id": "990e8400-e29b-41d4-a716-446655440004",
        "name": "Production Webhook",
        "url": "https://myserver.com/webhooks",
        "visibility": "private",
        "is_reusable": true,
        "endpoint_count": 2,
        "created_at": "2026-05-24T12:00:00Z"
      }
    ],
    "meta": {
      "count": 1,
      "has_more": false,
      "next_cursor": null
    }
  }
}

Get saved destination

GET /v1/destinations/:id

Includes a nested endpoints array of linked forward destinations (HTTPS attachments only).

curl -s "https://api.hookdeploy.dev/v1/destinations/DESTINATION_ID" \
  -H "Authorization: Bearer hd_live_YOUR_KEY"
{
  "data": {
    "id": "990e8400-e29b-41d4-a716-446655440004",
    "name": "Production Webhook",
    "url": "https://myserver.com/webhooks",
    "visibility": "private",
    "is_reusable": true,
    "created_at": "2026-05-24T12:00:00Z",
    "endpoints": [
      {
        "endpoint_id": "550e8400-e29b-41d4-a716-446655440000",
        "endpoint_name": "Stripe production",
        "forward_destination_id": "aa0e8400-e29b-41d4-a716-446655440005"
      }
    ]
  }
}

List forward destinations on an endpoint

GET /v1/endpoints/:id/destinations

Returns all forward destinations for an endpoint (HTTPS and agent), ordered by sort_order.

curl -s "https://api.hookdeploy.dev/v1/endpoints/ENDPOINT_ID/destinations" \
  -H "Authorization: Bearer hd_live_YOUR_KEY"

Response:

{
  "data": {
    "data": [
      {
        "id": "990e8400-e29b-41d4-a716-446655440004",
        "name": "Production Server",
        "url": "https://myserver.com/webhooks",
        "enabled": true,
        "method_override": null,
        "created_at": "2026-05-24T12:00:00Z",
        "destination_type": "https",
        "agent_id": null,
        "target_port": null,
        "target_path": null
      },
      {
        "id": "aa0e8400-e29b-41d4-a716-446655440005",
        "name": "Local API",
        "url": null,
        "enabled": true,
        "method_override": null,
        "created_at": "2026-05-24T12:05:00Z",
        "destination_type": "agent",
        "agent_id": "660e8400-e29b-41d4-a716-446655440001",
        "target_port": 3000,
        "target_path": "/webhooks/hookdeploy"
      }
    ]
  }
}

Forward destination fields:

FieldDescription
idUUID of the forward destination
nameDisplay name
destination_type"https" or "agent"
urlHTTPS target URL, or null for agent destinations
agent_idEnrolled agent UUID for agent destinations, otherwise null
target_portLoopback port (1–65535) for agent destinations, otherwise null
target_pathLoopback path for agent destinations, otherwise null
enabledWhether this destination is active. Disabled destinations are skipped during forwarding.
method_overrideHTTP method to use when forwarding, or null to mirror the original request method
created_atISO 8601 creation timestamp

Retry: Per-destination retry schedules (retry_enabled, retry_schedule, intelligent_retry) apply to HTTPS forward destinations only. Agent destinations use environment-based retry semantics instead — production agents automatically retry retryable failures; development agents never retry, regardless of those flags.

Rate limiting: When rate_limit_enabled is set, both HTTPS and agent forward destinations use the same smooth-delivery queue — requests are scheduled and dispatched at the configured rate.

Forward destinations are managed in the dashboard under Endpoints → [endpoint name] → Destinations. Saved HTTPS destinations live under Destinations.

Error responses (HTTPS saved flow)

HTTPCodeCause
400bad_requestMissing name/url or other validation errors
401unauthorizedInvalid API key
403forbiddenAPI key lacks permission to manage destinations
403plan_limitPlan caps (e.g. forward destination limit on attach)
404not_foundDestination or endpoint not found

Next steps