{
  "openapi": "3.1.0",
  "info": {
    "title": "PactReach Brand Public API",
    "version": "1",
    "summary": "API keys, signed webhooks, conversion postbacks, and read models for brand backends.",
    "description": "Server-to-server API for PactReach brands: API keys, signed outbound webhooks, idempotent conversion postbacks, and read models for campaigns, deals, placements, tracked links, escrow, and workspace.\n\nOwned and operated by **Neerstack LTD**. This is not the website JWT API used by pactreach.com login.\n\n## Envelope\n\nEvery JSON response uses `{ status, statusCode, message, data, requestId }`. Paginated lists also include `meta`.\n`errorCode` appears **only on failures** and is stable for automation. `message` is for humans.\n\n## Auth\n\n- Preferred: `X-Api-Key: pr_live_...`\n- Also accepted: `Authorization: Bearer pr_live_...`\n- `POST .../api-key/create-key` **always** uses `X-PactReach-Bootstrap-Token` (or Bearer with that token). It never accepts an API key.\n- Conversion postbacks also require `Idempotency-Key` (16-128 characters: letters, digits, dash, underscore, or colon).\n\n## Plan vs key scope\n\nBilling advertises Growth as read and Scale or Agency as full. Live routes authorize by **key scope**, not the current plan.\n`read` can list keys, webhooks, deliveries, campaigns, deals, tracked links, placements, escrow, conversions, workspace, and send a test ping.\n`write` can mint or revoke keys and register, update, rotate, or delete webhooks.\nConversion postbacks accept any valid key for that brand. If you omit `scopes` when creating a key, PactReach stores `[\"read\"]` only.\n\n## Webhooks\n\n`send-test` requires the endpoint to be **active**; a disabled endpoint returns not found. Default subscribe list (if you omit events) is `deal.completed` and `conversion.recorded`.\n`conversion.recorded` is emitted when a **new** postback is stored. Replays (`replay: true`) do not re-fire that event.\n\nHMAC-SHA256 over `{timestamp}.{rawBody}` with the endpoint signing secret. Compare to `X-PactReach-Signature` (`sha256=<hex>`). Reject timestamps older than about five minutes.\n\n## Read models\n\nCampaign and deal paths use the **plural** prefixes `/campaigns` and `/deals` so they do not collide with the website JWT wizard.\nEmpty lists are success. Get-by-id returns `NOT_FOUND` when the row is missing or not owned by this brand.\n\n## Out of scope\n\nThis API does not create campaigns, send invites, approve drafts, or move escrow. Those stay in the brand app.",
    "contact": {
      "name": "Neerstack LTD",
      "email": "support@pactreach.com",
      "url": "https://pactreach.com/developers"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://pactreach.com/legal/terms"
    }
  },
  "externalDocs": {
    "description": "Narrative guides (authentication, webhooks, conversions)",
    "url": "https://pactreach.com/developers"
  },
  "servers": [
    {
      "url": "https://api.pactreach.com/api/v1",
      "description": "Production"
    },
    {
      "url": "https://api-dev.pactreach.com/api/v1",
      "description": "Development"
    }
  ],
  "tags": [
    {
      "name": "API keys",
      "description": "Mint, list, and revoke `pr_live_...` keys. First key uses a Support-issued bootstrap token. Later keys use rotate-key with write scope."
    },
    {
      "name": "Webhooks",
      "description": "Register HTTPS receivers, rotate signing secrets, inspect deliveries, and send a test ping. send-test requires an active endpoint."
    },
    {
      "name": "Conversions",
      "description": "Idempotent postbacks from ad networks and attribution partners. Replays return the existing conversion and do not emit conversion.recorded. List and get are read-scoped."
    },
    {
      "name": "Campaigns",
      "description": "Read-only campaign status for the key's brand. Plural `/campaigns` prefix (not the website JWT wizard)."
    },
    {
      "name": "Deals",
      "description": "Read-only deals with escrow snapshot and settlement totals. Plural `/deals` prefix."
    },
    {
      "name": "Tracked links",
      "description": "Link codes and short URLs used to attribute conversions. Filter by campaignId, dealId, or code."
    },
    {
      "name": "Placements",
      "description": "Live post URLs and click stats. Ownership is via the campaign (placements have no brandId field)."
    },
    {
      "name": "Escrow",
      "description": "Read-only escrow holds. No release or refund from this API."
    },
    {
      "name": "Workspace",
      "description": "Brand plan, KYB status, subscription period, and the caller key scopes. No secrets."
    }
  ],
  "paths": {
    "/brand/{brandId}/api-key/create-key": {
      "post": {
        "operationId": "createKey",
        "summary": "Mint the first API key (bootstrap token)",
        "description": "Always uses `X-PactReach-Bootstrap-Token` (or Bearer with that token). Never an API key. Returns `data.secret` once. Use rotate-key after you have a write-scoped key. If `scopes` is omitted, PactReach stores `[\"read\"]` only.",
        "tags": [
          "API keys"
        ],
        "security": [
          {
            "BootstrapToken": []
          },
          {
            "BearerBootstrap": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyRequest"
              },
              "example": {
                "name": "Production",
                "scopes": [
                  "read",
                  "write"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Key created. Store the secret now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 201,
                  "message": "API key created. Store the secret now; it will not be shown again",
                  "data": {
                    "id": "64f0c2a1b8e4d12a9c7f00aa",
                    "name": "Production",
                    "keyPrefix": "pr_live_a1b2",
                    "scopes": [
                      "read",
                      "write"
                    ],
                    "secret": "pr_live_YOUR_KEY"
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "400": {
            "description": "Request body is invalid",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 400,
                        "message": "Request body is invalid",
                        "errorCode": "VALIDATION_ERROR",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 400,
                  "message": "Request body is invalid",
                  "errorCode": "VALIDATION_ERROR",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Invalid bootstrap token",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Invalid bootstrap token",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Invalid bootstrap token",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong. Please try again.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 500,
                        "message": "Something went wrong. Please try again.",
                        "errorCode": "INTERNAL_ERROR",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 500,
                  "message": "Something went wrong. Please try again.",
                  "errorCode": "INTERNAL_ERROR",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X POST 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/create-key' \\\n  -H 'Content-Type: application/json' \\\n  -H 'X-PactReach-Bootstrap-Token: YOUR_BOOTSTRAP_TOKEN' \\\n  -d '{\"name\":\"Production\",\"scopes\":[\"read\",\"write\"]}'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/create-key', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'X-PactReach-Bootstrap-Token': 'YOUR_BOOTSTRAP_TOKEN',\n  },\n  body: JSON.stringify({\n    \"name\": \"Production\",\n    \"scopes\": [\n      \"read\",\n      \"write\"\n    ]\n  }),\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/create-key', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'X-PactReach-Bootstrap-Token': 'YOUR_BOOTSTRAP_TOKEN',\n  },\n  body: JSON.stringify({\n    \"name\": \"Production\",\n    \"scopes\": [\n      \"read\",\n      \"write\"\n    ]\n  }),\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.post(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/create-key\",\n    headers={\n    \"Content-Type\": \"application/json\",\n    \"X-PactReach-Bootstrap-Token\": \"YOUR_BOOTSTRAP_TOKEN\",\n    },\n    json={\n      \"name\": \"Production\",\n      \"scopes\": [\n        \"read\",\n        \"write\"\n      ]\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/create-key');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'POST',\n  CURLOPT_HTTPHEADER => [\n    'Content-Type: application/json',\n    'X-PactReach-Bootstrap-Token: YOUR_BOOTSTRAP_TOKEN',\n  ],\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'Production',\n    'scopes' => ['read', 'write'],\n  ]),\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tbody, _ := json.Marshal(map[string]any{\"name\": \"Production\", \"scopes\": []any{\"read\", \"write\"}})\n\treq, _ := http.NewRequest(http.MethodPost, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/create-key\", bytes.NewReader(body))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"X-PactReach-Bootstrap-Token\", \"YOUR_BOOTSTRAP_TOKEN\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/api-key/rotate-key": {
      "post": {
        "operationId": "rotateKey",
        "summary": "Mint an additional API key",
        "description": "Write scope required. Mints a **new** key. Does not revoke the caller. Switch traffic, then revoke the old id. Secret is returned once.",
        "tags": [
          "API keys"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyRequest"
              },
              "example": {
                "name": "Production-2026-08",
                "scopes": [
                  "read",
                  "write"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Additional key created. The previous key stays valid until you revoke it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 201,
                  "message": "API key created. Store the secret now; it will not be shown again",
                  "data": {
                    "id": "64f0c2a1b8e4d12a9c7f00cc",
                    "name": "Production-2026-08",
                    "keyPrefix": "pr_live_c3d4",
                    "scopes": [
                      "read",
                      "write"
                    ],
                    "secret": "pr_live_YOUR_NEW_KEY"
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "400": {
            "description": "Request body is invalid",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 400,
                        "message": "Request body is invalid",
                        "errorCode": "VALIDATION_ERROR",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 400,
                  "message": "Request body is invalid",
                  "errorCode": "VALIDATION_ERROR",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "Write scope required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "Write scope required",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "Write scope required",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong. Please try again.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 500,
                        "message": "Something went wrong. Please try again.",
                        "errorCode": "INTERNAL_ERROR",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 500,
                  "message": "Something went wrong. Please try again.",
                  "errorCode": "INTERNAL_ERROR",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X POST 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/rotate-key' \\\n  -H 'Content-Type: application/json' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY' \\\n  -d '{\"name\":\"Production-2026-08\",\"scopes\":[\"read\",\"write\"]}'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/rotate-key', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n  body: JSON.stringify({\n    \"name\": \"Production-2026-08\",\n    \"scopes\": [\n      \"read\",\n      \"write\"\n    ]\n  }),\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/rotate-key', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n  body: JSON.stringify({\n    \"name\": \"Production-2026-08\",\n    \"scopes\": [\n      \"read\",\n      \"write\"\n    ]\n  }),\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.post(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/rotate-key\",\n    headers={\n    \"Content-Type\": \"application/json\",\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n    json={\n      \"name\": \"Production-2026-08\",\n      \"scopes\": [\n        \"read\",\n        \"write\"\n      ]\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/rotate-key');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'POST',\n  CURLOPT_HTTPHEADER => [\n    'Content-Type: application/json',\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n  CURLOPT_POSTFIELDS => json_encode([\n    'name' => 'Production-2026-08',\n    'scopes' => ['read', 'write'],\n  ]),\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tbody, _ := json.Marshal(map[string]any{\"name\": \"Production-2026-08\", \"scopes\": []any{\"read\", \"write\"}})\n\treq, _ := http.NewRequest(http.MethodPost, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/rotate-key\", bytes.NewReader(body))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/api-key/fetch-keys": {
      "get": {
        "operationId": "fetchKeys",
        "summary": "List active API keys",
        "description": "Read scope. Returns prefix, scopes, and last used time. Full secrets are never listed.",
        "tags": [
          "API keys"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Active keys for this brand.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "API keys fetched",
                  "data": [
                    {
                      "id": "64f0c2a1b8e4d12a9c7f00aa",
                      "name": "Production",
                      "keyPrefix": "pr_live_a1b2",
                      "scopes": [
                        "read",
                        "write"
                      ],
                      "lastUsedAt": "2026-08-13T06:00:00.000Z"
                    }
                  ],
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/fetch-keys' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/fetch-keys', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/fetch-keys', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/fetch-keys\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/fetch-keys');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/fetch-keys\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/api-key/{keyId}/revoke-key": {
      "delete": {
        "operationId": "revokeKey",
        "summary": "Revoke an API key",
        "description": "Write scope. Revoke is immediate. Requests with that secret fail at once.",
        "tags": [
          "API keys"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "keyId",
            "in": "path",
            "required": true,
            "description": "API key id returned by create-key or fetch-keys.",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f00aa"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Key revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "API key revoked",
                  "data": {
                    "id": "64f0c2a1b8e4d12a9c7f00aa"
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "Write scope required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "Write scope required",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "Write scope required",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "404": {
            "description": "API key not found",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 404,
                        "message": "API key not found",
                        "errorCode": "NOT_FOUND",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 404,
                  "message": "API key not found",
                  "errorCode": "NOT_FOUND",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X DELETE 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/64f0c2a1b8e4d12a9c7f00aa/revoke-key' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/64f0c2a1b8e4d12a9c7f00aa/revoke-key', {\n  method: 'DELETE',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/64f0c2a1b8e4d12a9c7f00aa/revoke-key', {\n  method: 'DELETE',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.delete(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/64f0c2a1b8e4d12a9c7f00aa/revoke-key\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/64f0c2a1b8e4d12a9c7f00aa/revoke-key');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'DELETE',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodDelete, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/api-key/64f0c2a1b8e4d12a9c7f00aa/revoke-key\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/webhook/register-endpoint": {
      "post": {
        "operationId": "registerWebhookEndpoint",
        "summary": "Register a webhook endpoint",
        "description": "Write scope. HTTPS in production; `http://localhost` is accepted for local development. If you omit `events`, the default is `deal.completed` and `conversion.recorded`. Returns `signingSecret` once. Unsupported event names are dropped; an empty filtered set returns VALIDATION_ERROR.",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterWebhookRequest"
              },
              "example": {
                "url": "https://api.example.com/pactreach/webhooks",
                "events": [
                  "deal.completed",
                  "escrow.released",
                  "conversion.recorded"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Endpoint registered. Store the signing secret now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 201,
                  "message": "Webhook endpoint registered",
                  "data": {
                    "id": "64f0c2a1b8e4d12a9c7f00bb",
                    "url": "https://api.example.com/pactreach/webhooks",
                    "events": [
                      "deal.completed",
                      "escrow.released",
                      "conversion.recorded"
                    ],
                    "signingSecret": "YOUR_SIGNING_SECRET"
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "400": {
            "description": "No supported webhook events in the request",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 400,
                        "message": "No supported webhook events in the request",
                        "errorCode": "VALIDATION_ERROR",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 400,
                  "message": "No supported webhook events in the request",
                  "errorCode": "VALIDATION_ERROR",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "Write scope required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "Write scope required",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "Write scope required",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong. Please try again.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 500,
                        "message": "Something went wrong. Please try again.",
                        "errorCode": "INTERNAL_ERROR",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 500,
                  "message": "Something went wrong. Please try again.",
                  "errorCode": "INTERNAL_ERROR",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X POST 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/register-endpoint' \\\n  -H 'Content-Type: application/json' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY' \\\n  -d '{\"url\":\"https://api.example.com/pactreach/webhooks\",\"events\":[\"deal.completed\",\"escrow.released\",\"conversion.recorded\"]}'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/register-endpoint', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n  body: JSON.stringify({\n    \"url\": \"https://api.example.com/pactreach/webhooks\",\n    \"events\": [\n      \"deal.completed\",\n      \"escrow.released\",\n      \"conversion.recorded\"\n    ]\n  }),\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/register-endpoint', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n  body: JSON.stringify({\n    \"url\": \"https://api.example.com/pactreach/webhooks\",\n    \"events\": [\n      \"deal.completed\",\n      \"escrow.released\",\n      \"conversion.recorded\"\n    ]\n  }),\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.post(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/register-endpoint\",\n    headers={\n    \"Content-Type\": \"application/json\",\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n    json={\n      \"url\": \"https://api.example.com/pactreach/webhooks\",\n      \"events\": [\n        \"deal.completed\",\n        \"escrow.released\",\n        \"conversion.recorded\"\n      ]\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/register-endpoint');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'POST',\n  CURLOPT_HTTPHEADER => [\n    'Content-Type: application/json',\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n  CURLOPT_POSTFIELDS => json_encode([\n    'url' => 'https://api.example.com/pactreach/webhooks',\n    'events' => ['deal.completed', 'escrow.released', 'conversion.recorded'],\n  ]),\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tbody, _ := json.Marshal(map[string]any{\"url\": \"https://api.example.com/pactreach/webhooks\", \"events\": []any{\"deal.completed\", \"escrow.released\", \"conversion.recorded\"}})\n\treq, _ := http.NewRequest(http.MethodPost, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/register-endpoint\", bytes.NewReader(body))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/webhook/fetch-endpoints": {
      "get": {
        "operationId": "fetchWebhookEndpoints",
        "summary": "List webhook endpoints",
        "description": "Read scope. Includes failure counters and disabledAt. An empty list is a normal success.",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Endpoints for this brand.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Webhook endpoints fetched",
                  "data": {
                    "endpoints": [
                      {
                        "id": "64f0c2a1b8e4d12a9c7f00bb",
                        "url": "https://api.example.com/pactreach/webhooks",
                        "events": [
                          "deal.completed",
                          "conversion.recorded"
                        ],
                        "isActive": true,
                        "consecutiveFailures": 0,
                        "disabledAt": null
                      }
                    ]
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/fetch-endpoints' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/fetch-endpoints', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/fetch-endpoints', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/fetch-endpoints\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/fetch-endpoints');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/fetch-endpoints\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/webhook/fetch-deliveries": {
      "get": {
        "operationId": "fetchWebhookDeliveries",
        "summary": "List webhook deliveries",
        "description": "Read scope. Paginated delivery log. Default sort is newest first (`sortOrder=desc`). `limit` is 1-100 (default 20).",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "delivered",
                "failed"
              ]
            }
          },
          {
            "name": "eventName",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "campaign.published",
                "campaign.completed",
                "campaign.cancelled",
                "campaign.budget_threshold",
                "deal.accepted",
                "deal.declined",
                "deal.expired",
                "deal.status_changed",
                "deal.completed",
                "deal.cancelled",
                "deal.disputed",
                "content.submitted",
                "placement.submitted",
                "placement.verified",
                "placement.metrics_updated",
                "escrow.held",
                "escrow.released",
                "escrow.refunded",
                "verification.completed",
                "dispute.resolved",
                "conversion.recorded",
                "webhook.test"
              ]
            }
          },
          {
            "name": "endpointId",
            "in": "query",
            "required": false,
            "description": "Scope the log to one endpoint. Omit for every endpoint on the brand.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated deliveries. Paging lives in meta.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Webhook deliveries fetched",
                  "data": {
                    "deliveries": [
                      {
                        "id": "64f0c2a1b8e4d12a9c7f00dd",
                        "endpointId": "64f0c2a1b8e4d12a9c7f00bb",
                        "eventName": "deal.completed",
                        "status": "delivered",
                        "httpStatus": 200,
                        "attemptCount": 1,
                        "lastError": null,
                        "deliveredAt": "2026-08-13T06:01:00.000Z",
                        "nextRetryAt": null,
                        "createdAt": "2026-08-13T06:00:50.000Z"
                      }
                    ]
                  },
                  "meta": {
                    "page": 1,
                    "limit": 20,
                    "total": 1,
                    "totalPages": 1,
                    "hasNextPage": false
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "400": {
            "description": "Query parameters are invalid",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 400,
                        "message": "Query parameters are invalid",
                        "errorCode": "VALIDATION_ERROR",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 400,
                  "message": "Query parameters are invalid",
                  "errorCode": "VALIDATION_ERROR",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/fetch-deliveries' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/fetch-deliveries', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/fetch-deliveries', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/fetch-deliveries\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/fetch-deliveries');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/fetch-deliveries\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/webhook/{endpointId}/update-endpoint": {
      "patch": {
        "operationId": "updateWebhookEndpoint",
        "summary": "Update a webhook endpoint",
        "description": "Write scope. Update URL, events, or `isActive`. Setting `isActive: true` also clears the consecutive-failure counter that previously switched the endpoint off.",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "endpointId",
            "in": "path",
            "required": true,
            "description": "Webhook endpoint id returned by register-endpoint or fetch-endpoints.",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f00bb"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWebhookRequest"
              },
              "example": {
                "isActive": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Endpoint updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Webhook endpoint updated",
                  "data": {
                    "id": "64f0c2a1b8e4d12a9c7f00bb",
                    "url": "https://api.example.com/pactreach/webhooks",
                    "events": [
                      "deal.completed",
                      "conversion.recorded"
                    ],
                    "isActive": true,
                    "consecutiveFailures": 0
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "400": {
            "description": "No supported webhook events in the request",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 400,
                        "message": "No supported webhook events in the request",
                        "errorCode": "VALIDATION_ERROR",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 400,
                  "message": "No supported webhook events in the request",
                  "errorCode": "VALIDATION_ERROR",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "Write scope required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "Write scope required",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "Write scope required",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "404": {
            "description": "Webhook endpoint not found",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 404,
                        "message": "Webhook endpoint not found",
                        "errorCode": "NOT_FOUND",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 404,
                  "message": "Webhook endpoint not found",
                  "errorCode": "NOT_FOUND",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X PATCH 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/update-endpoint' \\\n  -H 'Content-Type: application/json' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY' \\\n  -d '{\"isActive\":true}'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/update-endpoint', {\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n  body: JSON.stringify({\n    \"isActive\": true\n  }),\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/update-endpoint', {\n  method: 'PATCH',\n  headers: {\n    'Content-Type': 'application/json',\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n  body: JSON.stringify({\n    \"isActive\": true\n  }),\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.patch(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/update-endpoint\",\n    headers={\n    \"Content-Type\": \"application/json\",\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n    json={\n      \"isActive\": true\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/update-endpoint');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'PATCH',\n  CURLOPT_HTTPHEADER => [\n    'Content-Type: application/json',\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n  CURLOPT_POSTFIELDS => json_encode([\n    'isActive' => true,\n  ]),\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tbody, _ := json.Marshal(map[string]any{\"isActive\": true})\n\treq, _ := http.NewRequest(http.MethodPatch, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/update-endpoint\", bytes.NewReader(body))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/webhook/{endpointId}/rotate-secret": {
      "post": {
        "operationId": "rotateWebhookSecret",
        "summary": "Rotate the webhook signing secret",
        "description": "Write scope. The previous secret stops working immediately. Returns the new secret once. Update your verifier before or immediately after this call.",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "endpointId",
            "in": "path",
            "required": true,
            "description": "Webhook endpoint id returned by register-endpoint or fetch-endpoints.",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f00bb"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "New signing secret. Store it now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Webhook signing secret rotated",
                  "data": {
                    "id": "64f0c2a1b8e4d12a9c7f00bb",
                    "signingSecret": "YOUR_NEW_SIGNING_SECRET"
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "Write scope required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "Write scope required",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "Write scope required",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "404": {
            "description": "Webhook endpoint not found",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 404,
                        "message": "Webhook endpoint not found",
                        "errorCode": "NOT_FOUND",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 404,
                  "message": "Webhook endpoint not found",
                  "errorCode": "NOT_FOUND",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong. Please try again.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 500,
                        "message": "Something went wrong. Please try again.",
                        "errorCode": "INTERNAL_ERROR",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 500,
                  "message": "Something went wrong. Please try again.",
                  "errorCode": "INTERNAL_ERROR",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X POST 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/rotate-secret' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/rotate-secret', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/rotate-secret', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.post(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/rotate-secret\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/rotate-secret');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'POST',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodPost, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/rotate-secret\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/webhook/{endpointId}/delete-endpoint": {
      "delete": {
        "operationId": "deleteWebhookEndpoint",
        "summary": "Delete a webhook endpoint",
        "description": "Write scope. In-flight deliveries may still complete after delete.",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "endpointId",
            "in": "path",
            "required": true,
            "description": "Webhook endpoint id returned by register-endpoint or fetch-endpoints.",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f00bb"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Endpoint deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Webhook endpoint deleted",
                  "data": {
                    "id": "64f0c2a1b8e4d12a9c7f00bb"
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "Write scope required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "Write scope required",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "Write scope required",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "404": {
            "description": "Webhook endpoint not found",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 404,
                        "message": "Webhook endpoint not found",
                        "errorCode": "NOT_FOUND",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 404,
                  "message": "Webhook endpoint not found",
                  "errorCode": "NOT_FOUND",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X DELETE 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/delete-endpoint' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/delete-endpoint', {\n  method: 'DELETE',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/delete-endpoint', {\n  method: 'DELETE',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.delete(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/delete-endpoint\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/delete-endpoint');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'DELETE',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodDelete, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/delete-endpoint\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/webhook/{endpointId}/send-test": {
      "post": {
        "operationId": "sendWebhookTest",
        "summary": "Queue a webhook.test ping",
        "description": "Any valid key for the brand (read or write). The endpoint **must be active**; a disabled endpoint returns not found. Queues `webhook.test` to that endpoint only (HTTP 202). Use it to prove signature handling before you subscribe to money events.",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "endpointId",
            "in": "path",
            "required": true,
            "description": "Webhook endpoint id returned by register-endpoint or fetch-endpoints.",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f00bb"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Test delivery queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 202,
                  "message": "Test webhook queued",
                  "data": {
                    "deliveryId": "64f0c2a1b8e4d12a9c7f00ee"
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "404": {
            "description": "Webhook endpoint not found",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 404,
                        "message": "Webhook endpoint not found",
                        "errorCode": "NOT_FOUND",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 404,
                  "message": "Webhook endpoint not found",
                  "errorCode": "NOT_FOUND",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X POST 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/send-test' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/send-test', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/send-test', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.post(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/send-test\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/send-test');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'POST',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodPost, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/send-test\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/conversion/record-postback": {
      "post": {
        "operationId": "recordConversionPostback",
        "summary": "Record a conversion postback",
        "description": "Any valid key for the brand plus `Idempotency-Key`. `eventType` is required. Optional `clickId`, `linkCode`, integer `valueMinor` (default 0), `currency` (`NGN` or `USD`, default NGN), and opaque `metadata`.\n\nThe same idempotency key returns HTTP 200 with `replay: true` and the existing conversion. A different body with the same key still returns the first conversion and does not increment link stats again. A key that is already in flight (about 2 minutes) returns `IDEMPOTENCY_KEY_CONFLICT`.\n\nA **new** conversion emits `conversion.recorded` to subscribed webhooks. Replays do **not** re-fire that event. Unknown `linkCode` values are stored without attribution rather than rejected. This route is not IP-throttled.",
        "tags": [
          "Conversions"
        ],
        "security": [
          {
            "ApiKeyHeader": [],
            "IdempotencyKey": []
          },
          {
            "BearerAuth": [],
            "IdempotencyKey": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConversionPostbackRequest"
              },
              "example": {
                "eventType": "purchase",
                "clickId": "clk_01JEXAMPLE",
                "linkCode": "ab12cd",
                "valueMinor": 150000,
                "currency": "NGN",
                "metadata": {
                  "orderId": "99102"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replay of an existing idempotency key. conversion.recorded is not emitted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Conversion already recorded",
                  "data": {
                    "conversionId": "64f0c2a1b8e4d12a9c7f00ff",
                    "replay": true
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "201": {
            "description": "New conversion recorded. conversion.recorded is fanned out.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 201,
                  "message": "Conversion recorded",
                  "data": {
                    "conversionId": "64f0c2a1b8e4d12a9c7f00ff",
                    "attributed": true,
                    "replay": false
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "400": {
            "description": "This request requires an Idempotency-Key header.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 400,
                        "message": "This request requires an Idempotency-Key header.",
                        "errorCode": "IDEMPOTENCY_KEY_REQUIRED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 400,
                  "message": "This request requires an Idempotency-Key header.",
                  "errorCode": "IDEMPOTENCY_KEY_REQUIRED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "409": {
            "description": "A request with this Idempotency-Key is already being processed. Retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 409,
                        "message": "A request with this Idempotency-Key is already being processed. Retry shortly.",
                        "errorCode": "IDEMPOTENCY_KEY_CONFLICT",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 409,
                  "message": "A request with this Idempotency-Key is already being processed. Retry shortly.",
                  "errorCode": "IDEMPOTENCY_KEY_CONFLICT",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong. Please try again.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 500,
                        "message": "Something went wrong. Please try again.",
                        "errorCode": "INTERNAL_ERROR",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 500,
                  "message": "Something went wrong. Please try again.",
                  "errorCode": "INTERNAL_ERROR",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X POST 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/record-postback' \\\n  -H 'Content-Type: application/json' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY' \\\n  -H 'Idempotency-Key: conv:2026-08-13:order-99102' \\\n  -d '{\"eventType\":\"purchase\",\"clickId\":\"clk_01JEXAMPLE\",\"linkCode\":\"ab12cd\",\"valueMinor\":150000,\"currency\":\"NGN\",\"metadata\":{\"orderId\":\"99102\"}}'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/record-postback', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n    'Idempotency-Key': 'conv:2026-08-13:order-99102',\n  },\n  body: JSON.stringify({\n    \"eventType\": \"purchase\",\n    \"clickId\": \"clk_01JEXAMPLE\",\n    \"linkCode\": \"ab12cd\",\n    \"valueMinor\": 150000,\n    \"currency\": \"NGN\",\n    \"metadata\": {\n      \"orderId\": \"99102\"\n    }\n  }),\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/record-postback', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n    'Idempotency-Key': 'conv:2026-08-13:order-99102',\n  },\n  body: JSON.stringify({\n    \"eventType\": \"purchase\",\n    \"clickId\": \"clk_01JEXAMPLE\",\n    \"linkCode\": \"ab12cd\",\n    \"valueMinor\": 150000,\n    \"currency\": \"NGN\",\n    \"metadata\": {\n      \"orderId\": \"99102\"\n    }\n  }),\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.post(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/record-postback\",\n    headers={\n    \"Content-Type\": \"application/json\",\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    \"Idempotency-Key\": \"conv:2026-08-13:order-99102\",\n    },\n    json={\n      \"eventType\": \"purchase\",\n      \"clickId\": \"clk_01JEXAMPLE\",\n      \"linkCode\": \"ab12cd\",\n      \"valueMinor\": 150000,\n      \"currency\": \"NGN\",\n      \"metadata\": {\n        \"orderId\": \"99102\"\n      }\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/record-postback');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'POST',\n  CURLOPT_HTTPHEADER => [\n    'Content-Type: application/json',\n    'X-Api-Key: pr_live_YOUR_KEY',\n    'Idempotency-Key: conv:2026-08-13:order-99102',\n  ],\n  CURLOPT_POSTFIELDS => json_encode([\n    'eventType' => 'purchase',\n    'clickId' => 'clk_01JEXAMPLE',\n    'linkCode' => 'ab12cd',\n    'valueMinor' => 150000,\n    'currency' => 'NGN',\n    'metadata' => [\n      'orderId' => '99102',\n    ],\n  ]),\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tbody, _ := json.Marshal(map[string]any{\"eventType\": \"purchase\", \"clickId\": \"clk_01JEXAMPLE\", \"linkCode\": \"ab12cd\", \"valueMinor\": 150000, \"currency\": \"NGN\", \"metadata\": map[string]any{\"orderId\": \"99102\"}})\n\treq, _ := http.NewRequest(http.MethodPost, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/record-postback\", bytes.NewReader(body))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\treq.Header.Set(\"Idempotency-Key\", \"conv:2026-08-13:order-99102\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/webhook/{endpointId}/fetch-endpoint": {
      "get": {
        "operationId": "fetchWebhookEndpoint",
        "summary": "Get a webhook endpoint",
        "description": "Read scope. Returns URL, events, and failure state for one endpoint. Does not return the signing secret.",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "endpointId",
            "in": "path",
            "required": true,
            "description": "Webhook endpoint id returned by register-endpoint or fetch-endpoints.",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f00bb"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Endpoint fetched.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Webhook endpoint fetched",
                  "data": {
                    "endpoint": {
                      "id": "64f0c2a1b8e4d12a9c7f00bb",
                      "url": "https://api.example.com/pactreach/webhooks",
                      "events": [
                        "deal.completed",
                        "conversion.recorded"
                      ],
                      "isActive": true,
                      "consecutiveFailures": 0,
                      "disabledAt": null
                    }
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "404": {
            "description": "Webhook endpoint not found",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 404,
                        "message": "Webhook endpoint not found",
                        "errorCode": "NOT_FOUND",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 404,
                  "message": "Webhook endpoint not found",
                  "errorCode": "NOT_FOUND",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/fetch-endpoint' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/fetch-endpoint', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/fetch-endpoint', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/fetch-endpoint\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/fetch-endpoint');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00bb/fetch-endpoint\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/webhook/{deliveryId}/fetch-delivery": {
      "get": {
        "operationId": "fetchWebhookDelivery",
        "summary": "Get a webhook delivery",
        "description": "Read scope. Includes the signed payload body, HTTP status, attempt count, and last error.",
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "description": "Webhook delivery id from fetch-deliveries.",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f00dd"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Delivery fetched.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Webhook delivery fetched",
                  "data": {
                    "delivery": {
                      "id": "64f0c2a1b8e4d12a9c7f00dd",
                      "endpointId": "64f0c2a1b8e4d12a9c7f00bb",
                      "eventName": "deal.completed",
                      "status": "delivered",
                      "httpStatus": 200,
                      "attemptCount": 1,
                      "lastError": null,
                      "payload": {
                        "dealId": "64f0c2a1b8e4d12a9c7f0123"
                      },
                      "deliveredAt": "2026-08-13T06:01:00.000Z"
                    }
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "404": {
            "description": "Webhook delivery not found",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 404,
                        "message": "Webhook delivery not found",
                        "errorCode": "NOT_FOUND",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 404,
                  "message": "Webhook delivery not found",
                  "errorCode": "NOT_FOUND",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00dd/fetch-delivery' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00dd/fetch-delivery', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00dd/fetch-delivery', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00dd/fetch-delivery\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00dd/fetch-delivery');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/webhook/64f0c2a1b8e4d12a9c7f00dd/fetch-delivery\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/conversion/fetch-postbacks": {
      "get": {
        "operationId": "fetchConversionPostbacks",
        "summary": "List conversion postbacks",
        "description": "Read scope. Paginated conversions for this brand (pixel and postback). Filter with `source`, `eventType`, `campaignId`, or `dealId`. Empty list is success.",
        "tags": [
          "Conversions"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "createdAt"
              ],
              "default": "createdAt"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          },
          {
            "name": "campaignId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "dealId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "eventType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "purchase"
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pixel",
                "postback"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated conversions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Conversions fetched",
                  "data": {
                    "conversions": [
                      {
                        "id": "64f0c2a1b8e4d12a9c7f00ff",
                        "eventType": "purchase",
                        "source": "postback",
                        "valueMinor": 150000,
                        "currency": "NGN",
                        "attributed": true,
                        "clickId": "clk_01JEXAMPLE"
                      }
                    ]
                  },
                  "meta": {
                    "page": 1,
                    "limit": 20,
                    "total": 1,
                    "totalPages": 1,
                    "hasNextPage": false
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/fetch-postbacks' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/fetch-postbacks', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/fetch-postbacks', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/fetch-postbacks\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/fetch-postbacks');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/fetch-postbacks\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/conversion/{conversionId}/fetch-postback": {
      "get": {
        "operationId": "fetchConversionPostback",
        "summary": "Get a conversion postback",
        "description": "Read scope. Returns one conversion owned by this brand.",
        "tags": [
          "Conversions"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "conversionId",
            "in": "path",
            "required": true,
            "description": "Conversion id from record-postback or fetch-postbacks.",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f00ff"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Conversion fetched.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Conversion fetched",
                  "data": {
                    "conversion": {
                      "id": "64f0c2a1b8e4d12a9c7f00ff",
                      "eventType": "purchase",
                      "source": "postback",
                      "valueMinor": 150000,
                      "currency": "NGN",
                      "attributed": true
                    }
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "404": {
            "description": "Conversion not found",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 404,
                        "message": "Conversion not found",
                        "errorCode": "NOT_FOUND",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 404,
                  "message": "Conversion not found",
                  "errorCode": "NOT_FOUND",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/64f0c2a1b8e4d12a9c7f00ff/fetch-postback' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/64f0c2a1b8e4d12a9c7f00ff/fetch-postback', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/64f0c2a1b8e4d12a9c7f00ff/fetch-postback', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/64f0c2a1b8e4d12a9c7f00ff/fetch-postback\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/64f0c2a1b8e4d12a9c7f00ff/fetch-postback');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/conversion/64f0c2a1b8e4d12a9c7f00ff/fetch-postback\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/campaigns/fetch-campaigns": {
      "get": {
        "operationId": "fetchCampaigns",
        "summary": "List campaigns",
        "description": "Read scope. Status, title, dates, budget buckets, and pricing model. Plural `/campaigns` path (not the JWT wizard). Filter by `status`.",
        "tags": [
          "Campaigns"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "createdAt",
                "updatedAt",
                "startAt",
                "endAt"
              ],
              "default": "createdAt"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "in_review",
                "rejected",
                "pending_funding",
                "active",
                "paused",
                "completed",
                "cancelled",
                "archived"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated campaigns.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Campaigns fetched",
                  "data": {
                    "campaigns": [
                      {
                        "id": "64f0c2a1b8e4d12a9c7f0123",
                        "title": "Summer launch",
                        "status": "active",
                        "currency": "NGN",
                        "pricingModel": "cpc",
                        "totalBudgetMinor": 50000000,
                        "committedBudgetMinor": 20000000,
                        "startAt": "2026-08-01T00:00:00.000Z",
                        "endAt": "2026-09-15T00:00:00.000Z"
                      }
                    ]
                  },
                  "meta": {
                    "page": 1,
                    "limit": 20,
                    "total": 1,
                    "totalPages": 1,
                    "hasNextPage": false
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/campaigns/fetch-campaigns' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/campaigns/fetch-campaigns', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/campaigns/fetch-campaigns', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/campaigns/fetch-campaigns\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/campaigns/fetch-campaigns');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/campaigns/fetch-campaigns\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/campaigns/{campaignId}/fetch-campaign": {
      "get": {
        "operationId": "fetchCampaign",
        "summary": "Get a campaign",
        "description": "Read scope. Same fields as the list plus destination URL and slim deliverables.",
        "tags": [
          "Campaigns"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Campaign id from fetch-campaigns.",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0123"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Campaign fetched.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Campaign fetched",
                  "data": {
                    "campaign": {
                      "id": "64f0c2a1b8e4d12a9c7f0123",
                      "title": "Summer launch",
                      "status": "active",
                      "destinationUrl": "https://example.com/summer",
                      "deliverables": [
                        {
                          "key": "ig_reel",
                          "platform": "instagram",
                          "contentType": "reel",
                          "quantity": 1
                        }
                      ]
                    }
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "404": {
            "description": "Campaign not found",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 404,
                        "message": "Campaign not found",
                        "errorCode": "NOT_FOUND",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 404,
                  "message": "Campaign not found",
                  "errorCode": "NOT_FOUND",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/campaigns/64f0c2a1b8e4d12a9c7f0123/fetch-campaign' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/campaigns/64f0c2a1b8e4d12a9c7f0123/fetch-campaign', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/campaigns/64f0c2a1b8e4d12a9c7f0123/fetch-campaign', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/campaigns/64f0c2a1b8e4d12a9c7f0123/fetch-campaign\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/campaigns/64f0c2a1b8e4d12a9c7f0123/fetch-campaign');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/campaigns/64f0c2a1b8e4d12a9c7f0123/fetch-campaign\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/deals/fetch-deals": {
      "get": {
        "operationId": "fetchDeals",
        "summary": "List deals",
        "description": "Read scope. Includes escrow snapshot and settlement totals. Filter by `status` or `campaignId`.",
        "tags": [
          "Deals"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "createdAt",
                "updatedAt",
                "acceptedAt",
                "completedAt"
              ],
              "default": "createdAt"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "invited",
                "applied",
                "negotiating",
                "declined",
                "expired",
                "accepted",
                "content_pending",
                "content_in_review",
                "content_revision",
                "live",
                "verifying",
                "awaiting_settlement",
                "completed",
                "disputed",
                "cancelled"
              ]
            }
          },
          {
            "name": "campaignId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated deals.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Deals fetched",
                  "data": {
                    "deals": [
                      {
                        "id": "64f0c2a1b8e4d12a9c7f0456",
                        "reference": "DL-1024",
                        "status": "live",
                        "campaignTitle": "Summer launch",
                        "agreedAmountMinor": 15000000,
                        "currency": "NGN",
                        "escrow": {
                          "status": "held",
                          "heldMinor": 15000000,
                          "releasedMinor": 0,
                          "refundedMinor": 0
                        }
                      }
                    ]
                  },
                  "meta": {
                    "page": 1,
                    "limit": 20,
                    "total": 1,
                    "totalPages": 1,
                    "hasNextPage": false
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/deals/fetch-deals' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/deals/fetch-deals', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/deals/fetch-deals', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/deals/fetch-deals\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/deals/fetch-deals');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/deals/fetch-deals\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/deals/{dealId}/fetch-deal": {
      "get": {
        "operationId": "fetchDeal",
        "summary": "Get a deal",
        "description": "Read scope. Escrow snapshot and settlement totals included.",
        "tags": [
          "Deals"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "dealId",
            "in": "path",
            "required": true,
            "description": "Deal id from fetch-deals.",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0456"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deal fetched.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Deal fetched",
                  "data": {
                    "deal": {
                      "id": "64f0c2a1b8e4d12a9c7f0456",
                      "reference": "DL-1024",
                      "status": "live",
                      "escrow": {
                        "status": "held",
                        "heldMinor": 15000000
                      }
                    }
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "404": {
            "description": "Deal not found",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 404,
                        "message": "Deal not found",
                        "errorCode": "NOT_FOUND",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 404,
                  "message": "Deal not found",
                  "errorCode": "NOT_FOUND",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/deals/64f0c2a1b8e4d12a9c7f0456/fetch-deal' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/deals/64f0c2a1b8e4d12a9c7f0456/fetch-deal', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/deals/64f0c2a1b8e4d12a9c7f0456/fetch-deal', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/deals/64f0c2a1b8e4d12a9c7f0456/fetch-deal\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/deals/64f0c2a1b8e4d12a9c7f0456/fetch-deal');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/deals/64f0c2a1b8e4d12a9c7f0456/fetch-deal\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/tracked-link/fetch-links": {
      "get": {
        "operationId": "fetchTrackedLinks",
        "summary": "List tracked links",
        "description": "Read scope. Returns `code` and `shortUrl` (`https://pactreach.com/<code>`). Filter by `campaignId`, `dealId`, `code`, or `status`.",
        "tags": [
          "Tracked links"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "createdAt",
                "updatedAt"
              ],
              "default": "createdAt"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          },
          {
            "name": "campaignId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "dealId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "ab12cd"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "paused",
                "expired",
                "disabled"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated tracked links.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Tracked links fetched",
                  "data": {
                    "links": [
                      {
                        "id": "64f0c2a1b8e4d12a9c7f0789",
                        "code": "ab12cd",
                        "shortUrl": "https://pactreach.com/ab12cd",
                        "status": "active",
                        "destinationUrl": "https://example.com/summer",
                        "stats": {
                          "raw": 120,
                          "qualified": 98,
                          "conversions": 4
                        }
                      }
                    ]
                  },
                  "meta": {
                    "page": 1,
                    "limit": 20,
                    "total": 1,
                    "totalPages": 1,
                    "hasNextPage": false
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/tracked-link/fetch-links' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/tracked-link/fetch-links', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/tracked-link/fetch-links', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/tracked-link/fetch-links\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/tracked-link/fetch-links');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/tracked-link/fetch-links\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/tracked-link/{linkId}/fetch-link": {
      "get": {
        "operationId": "fetchTrackedLink",
        "summary": "Get a tracked link",
        "description": "Read scope. Click and conversion stats included.",
        "tags": [
          "Tracked links"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "linkId",
            "in": "path",
            "required": true,
            "description": "Tracked link id from fetch-links.",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0789"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tracked link fetched.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Tracked link fetched",
                  "data": {
                    "link": {
                      "id": "64f0c2a1b8e4d12a9c7f0789",
                      "code": "ab12cd",
                      "shortUrl": "https://pactreach.com/ab12cd",
                      "status": "active"
                    }
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "404": {
            "description": "Tracked link not found",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 404,
                        "message": "Tracked link not found",
                        "errorCode": "NOT_FOUND",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 404,
                  "message": "Tracked link not found",
                  "errorCode": "NOT_FOUND",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/tracked-link/64f0c2a1b8e4d12a9c7f0789/fetch-link' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/tracked-link/64f0c2a1b8e4d12a9c7f0789/fetch-link', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/tracked-link/64f0c2a1b8e4d12a9c7f0789/fetch-link', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/tracked-link/64f0c2a1b8e4d12a9c7f0789/fetch-link\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/tracked-link/64f0c2a1b8e4d12a9c7f0789/fetch-link');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/tracked-link/64f0c2a1b8e4d12a9c7f0789/fetch-link\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/placement/fetch-placements": {
      "get": {
        "operationId": "fetchPlacements",
        "summary": "List placements",
        "description": "Read scope. Live post URLs and click stats. Filter by `campaignId`, `dealId`, or `status`. Ownership is via the campaign.",
        "tags": [
          "Placements"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "createdAt",
                "updatedAt",
                "publishedAt"
              ],
              "default": "createdAt"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          },
          {
            "name": "campaignId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "dealId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "submitted",
                "live",
                "metrics_collected",
                "verified",
                "rejected",
                "flagged",
                "removed_early",
                "expired"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated placements.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Placements fetched",
                  "data": {
                    "placements": [
                      {
                        "id": "64f0c2a1b8e4d12a9c7f0abc",
                        "deliverableKey": "ig_reel",
                        "platform": "instagram",
                        "status": "live",
                        "postUrl": "https://instagram.com/p/EXAMPLE",
                        "clickStats": {
                          "raw": 120,
                          "qualified": 98
                        }
                      }
                    ]
                  },
                  "meta": {
                    "page": 1,
                    "limit": 20,
                    "total": 1,
                    "totalPages": 1,
                    "hasNextPage": false
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/placement/fetch-placements' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/placement/fetch-placements', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/placement/fetch-placements', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/placement/fetch-placements\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/placement/fetch-placements');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/placement/fetch-placements\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/placement/{placementId}/fetch-placement": {
      "get": {
        "operationId": "fetchPlacement",
        "summary": "Get a placement",
        "description": "Read scope. Returns one placement owned via this brand's campaign.",
        "tags": [
          "Placements"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "placementId",
            "in": "path",
            "required": true,
            "description": "Placement id from fetch-placements.",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0abc"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Placement fetched.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Placement fetched",
                  "data": {
                    "placement": {
                      "id": "64f0c2a1b8e4d12a9c7f0abc",
                      "status": "live",
                      "postUrl": "https://instagram.com/p/EXAMPLE"
                    }
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "404": {
            "description": "Placement not found",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 404,
                        "message": "Placement not found",
                        "errorCode": "NOT_FOUND",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 404,
                  "message": "Placement not found",
                  "errorCode": "NOT_FOUND",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/placement/64f0c2a1b8e4d12a9c7f0abc/fetch-placement' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/placement/64f0c2a1b8e4d12a9c7f0abc/fetch-placement', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/placement/64f0c2a1b8e4d12a9c7f0abc/fetch-placement', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/placement/64f0c2a1b8e4d12a9c7f0abc/fetch-placement\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/placement/64f0c2a1b8e4d12a9c7f0abc/fetch-placement');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/placement/64f0c2a1b8e4d12a9c7f0abc/fetch-placement\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/escrow/fetch-holds": {
      "get": {
        "operationId": "fetchEscrowHolds",
        "summary": "List escrow holds",
        "description": "Read scope. Original / held / released / refunded minor units. Does not release or refund. Filter by `campaignId`, `dealId`, or `status`.",
        "tags": [
          "Escrow"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "createdAt",
                "heldAt",
                "closedAt"
              ],
              "default": "createdAt"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          },
          {
            "name": "campaignId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "dealId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "held",
                "partially_released",
                "released",
                "refunded",
                "split",
                "frozen",
                "cancelled"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated escrow holds.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Escrow holds fetched",
                  "data": {
                    "holds": [
                      {
                        "id": "64f0c2a1b8e4d12a9c7f0def",
                        "reference": "ESC-1024",
                        "status": "held",
                        "currency": "NGN",
                        "originalMinor": 15000000,
                        "heldMinor": 15000000,
                        "releasedMinor": 0,
                        "refundedMinor": 0
                      }
                    ]
                  },
                  "meta": {
                    "page": 1,
                    "limit": 20,
                    "total": 1,
                    "totalPages": 1,
                    "hasNextPage": false
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/escrow/fetch-holds' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/escrow/fetch-holds', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/escrow/fetch-holds', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/escrow/fetch-holds\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/escrow/fetch-holds');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/escrow/fetch-holds\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/escrow/{holdId}/fetch-hold": {
      "get": {
        "operationId": "fetchEscrowHold",
        "summary": "Get an escrow hold",
        "description": "Read scope. Includes hold events (created, release, refund). Does not move money.",
        "tags": [
          "Escrow"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          },
          {
            "name": "holdId",
            "in": "path",
            "required": true,
            "description": "Escrow hold id from fetch-holds or a deal escrowHoldId.",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0def"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Escrow hold fetched.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Escrow hold fetched",
                  "data": {
                    "hold": {
                      "id": "64f0c2a1b8e4d12a9c7f0def",
                      "status": "held",
                      "originalMinor": 15000000,
                      "heldMinor": 15000000,
                      "events": [
                        {
                          "kind": "created",
                          "amountMinor": 15000000,
                          "reason": "accept"
                        }
                      ]
                    }
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "404": {
            "description": "Escrow hold not found",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 404,
                        "message": "Escrow hold not found",
                        "errorCode": "NOT_FOUND",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 404,
                  "message": "Escrow hold not found",
                  "errorCode": "NOT_FOUND",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/escrow/64f0c2a1b8e4d12a9c7f0def/fetch-hold' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/escrow/64f0c2a1b8e4d12a9c7f0def/fetch-hold', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/escrow/64f0c2a1b8e4d12a9c7f0def/fetch-hold', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/escrow/64f0c2a1b8e4d12a9c7f0def/fetch-hold\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/escrow/64f0c2a1b8e4d12a9c7f0def/fetch-hold');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/escrow/64f0c2a1b8e4d12a9c7f0def/fetch-hold\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    },
    "/brand/{brandId}/workspace/fetch-workspace": {
      "get": {
        "operationId": "fetchWorkspace",
        "summary": "Get brand workspace summary",
        "description": "Read scope. Company name, plan, KYB status, subscription period, and the caller key id + scopes. Does not return secrets, contacts, or PSP references.",
        "tags": [
          "Workspace"
        ],
        "security": [
          {
            "ApiKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "brandId",
            "in": "path",
            "required": true,
            "description": "Brand workspace id. Must match the API key (or the bootstrap token workspace).",
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f0011"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Workspace fetched.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                },
                "example": {
                  "status": true,
                  "statusCode": 200,
                  "message": "Workspace fetched",
                  "data": {
                    "brand": {
                      "id": "64f0c2a1b8e4d12a9c7f0011",
                      "companyName": "Acme Ltd",
                      "slug": "acme",
                      "status": "active",
                      "planCode": "scale",
                      "defaultCurrency": "NGN",
                      "kybStatus": "verified"
                    },
                    "subscription": {
                      "planCode": "scale",
                      "status": "active",
                      "cancelAtPeriodEnd": false
                    },
                    "key": {
                      "id": "64f0c2a1b8e4d12a9c7f00aa",
                      "scopes": [
                        "read",
                        "write"
                      ]
                    }
                  },
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "401": {
            "description": "Valid API key required",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 401,
                        "message": "Valid API key required",
                        "errorCode": "UNAUTHORIZED",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 401,
                  "message": "Valid API key required",
                  "errorCode": "UNAUTHORIZED",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "403": {
            "description": "API key does not belong to this brand",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 403,
                        "message": "API key does not belong to this brand",
                        "errorCode": "FORBIDDEN",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 403,
                  "message": "API key does not belong to this brand",
                  "errorCode": "FORBIDDEN",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          },
          "404": {
            "description": "Brand workspace not found",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    },
                    {
                      "example": {
                        "status": false,
                        "statusCode": 404,
                        "message": "Brand workspace not found",
                        "errorCode": "NOT_FOUND",
                        "requestId": "req_01JEXAMPLE"
                      }
                    }
                  ]
                },
                "example": {
                  "status": false,
                  "statusCode": 404,
                  "message": "Brand workspace not found",
                  "errorCode": "NOT_FOUND",
                  "requestId": "req_01JEXAMPLE"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -sS -X GET 'https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/workspace/fetch-workspace' \\\n  -H 'X-Api-Key: pr_live_YOUR_KEY'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript (fetch)",
            "source": "const response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/workspace/fetch-workspace', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import { fetch } from 'undici'; // Node 18+ also has global fetch\n\nconst response = await fetch('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/workspace/fetch-workspace', {\n  method: 'GET',\n  headers: {\n    'X-Api-Key': 'pr_live_YOUR_KEY',\n  },\n});\nconst envelope = await response.json();\nconsole.log(envelope.statusCode, envelope.data, envelope.errorCode, envelope.requestId);"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nresponse = requests.get(\n    \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/workspace/fetch-workspace\",\n    headers={\n    \"X-Api-Key\": \"pr_live_YOUR_KEY\",\n    },\n)\nenvelope = response.json()\nprint(envelope[\"statusCode\"], envelope.get(\"data\"), envelope.get(\"errorCode\"), envelope[\"requestId\"])"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/workspace/fetch-workspace');\ncurl_setopt_array($ch, [\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => 'GET',\n  CURLOPT_HTTPHEADER => [\n    'X-Api-Key: pr_live_YOUR_KEY',\n  ],\n]);\n$envelope = json_decode(curl_exec($ch), true);\ncurl_close($ch);"
          },
          {
            "lang": "Go",
            "label": "Go",
            "source": "package main\n\nimport (\n\t\"net/http\"\n)\n\nfunc main() {\n\treq, _ := http.NewRequest(http.MethodGet, \"https://api.pactreach.com/api/v1/brand/64f0c2a1b8e4d12a9c7f0011/workspace/fetch-workspace\", nil)\n\treq.Header.Set(\"X-Api-Key\", \"pr_live_YOUR_KEY\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n}"
          }
        ]
      }
    }
  },
  "webhooks": {
    "pactReachDelivery": {
      "post": {
        "operationId": "receivePactReachWebhook",
        "summary": "Outbound signed webhook (PactReach to you)",
        "description": "PactReach POSTs signed JSON to your registered URL when a subscribed event fires. Verify HMAC-SHA256 of `{timestamp}.{rawBody}` with the endpoint signing secret. Compare to `X-PactReach-Signature` (`sha256=<hex>`) using a constant-time equals. Reject if the timestamp is older than about five minutes. Return any 2xx within 10 seconds. Non-2xx retries up to 6 attempts (~30s, 2m, 10m, 1h, 6h). 20 consecutive failures switch the endpoint off; PATCH `isActive: true` to re-enable.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "X-PactReach-Event",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "campaign.published",
                "campaign.completed",
                "campaign.cancelled",
                "campaign.budget_threshold",
                "deal.accepted",
                "deal.declined",
                "deal.expired",
                "deal.status_changed",
                "deal.completed",
                "deal.cancelled",
                "deal.disputed",
                "content.submitted",
                "placement.submitted",
                "placement.verified",
                "placement.metrics_updated",
                "escrow.held",
                "escrow.released",
                "escrow.refunded",
                "verification.completed",
                "dispute.resolved",
                "conversion.recorded",
                "webhook.test"
              ],
              "example": "deal.completed"
            }
          },
          {
            "name": "X-PactReach-Delivery",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "example": "64f0c2a1b8e4d12a9c7f00dd"
            }
          },
          {
            "name": "X-PactReach-Timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds.",
            "schema": {
              "type": "string",
              "example": "1755064800"
            }
          },
          {
            "name": "X-PactReach-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "example": "sha256=abcdef0123456789"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookDeliveryPayload"
              },
              "example": {
                "event": "deal.completed",
                "data": {
                  "dealId": "64f0c2a1b8e4d12a9c7f0123"
                },
                "deliveryId": "64f0c2a1b8e4d12a9c7f00dd",
                "sentAt": "2026-08-13T06:00:00.000Z"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery within 10 seconds."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "Brand API key (`pr_live_...`). Preferred."
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Same `pr_live_...` key as `Authorization: Bearer`. Alternative to X-Api-Key."
      },
      "BootstrapToken": {
        "type": "apiKey",
        "in": "header",
        "name": "X-PactReach-Bootstrap-Token",
        "description": "Support-issued bootstrap token. Required for create-key. Not an API key and not a website JWT."
      },
      "BearerBootstrap": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bootstrap token may also be sent as Authorization Bearer on create-key."
      },
      "IdempotencyKey": {
        "type": "apiKey",
        "in": "header",
        "name": "Idempotency-Key",
        "description": "Required on conversion postbacks. 16-128 characters: letters, digits, dash, underscore, or colon."
      }
    },
    "schemas": {
      "SuccessEnvelope": {
        "type": "object",
        "required": [
          "status",
          "statusCode",
          "message",
          "requestId"
        ],
        "description": "Success envelope. `errorCode` is omitted. `data` shape is endpoint-specific. Paginated lists include `meta`.",
        "properties": {
          "status": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "statusCode": {
            "type": "integer",
            "example": 200
          },
          "message": {
            "type": "string"
          },
          "data": {
            "description": "Endpoint-specific payload."
          },
          "meta": {
            "$ref": "#/components/schemas/PageMeta"
          },
          "requestId": {
            "type": "string",
            "example": "req_01JEXAMPLE"
          }
        }
      },
      "ErrorEnvelope": {
        "type": "object",
        "required": [
          "status",
          "statusCode",
          "message",
          "errorCode",
          "requestId"
        ],
        "description": "Failure envelope. `errorCode` is present only on failures.",
        "properties": {
          "status": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "statusCode": {
            "type": "integer",
            "example": 401
          },
          "message": {
            "type": "string"
          },
          "errorCode": {
            "type": "string",
            "enum": [
              "UNAUTHORIZED",
              "FORBIDDEN",
              "NOT_FOUND",
              "VALIDATION_ERROR",
              "IDEMPOTENCY_KEY_REQUIRED",
              "IDEMPOTENCY_KEY_CONFLICT",
              "INTERNAL_ERROR"
            ]
          },
          "requestId": {
            "type": "string",
            "example": "req_01JEXAMPLE"
          }
        }
      },
      "PageMeta": {
        "type": "object",
        "properties": {
          "page": {
            "type": "integer",
            "minimum": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "totalPages": {
            "type": "integer",
            "minimum": 1
          },
          "hasNextPage": {
            "type": "boolean"
          }
        }
      },
      "ApiKeyScope": {
        "type": "string",
        "enum": [
          "read",
          "write"
        ]
      },
      "WebhookEventName": {
        "type": "string",
        "enum": [
          "campaign.published",
          "campaign.completed",
          "campaign.cancelled",
          "campaign.budget_threshold",
          "deal.accepted",
          "deal.declined",
          "deal.expired",
          "deal.status_changed",
          "deal.completed",
          "deal.cancelled",
          "deal.disputed",
          "content.submitted",
          "placement.submitted",
          "placement.verified",
          "placement.metrics_updated",
          "escrow.held",
          "escrow.released",
          "escrow.refunded",
          "verification.completed",
          "dispute.resolved",
          "conversion.recorded",
          "webhook.test"
        ],
        "description": "`campaign.published`: Campaign left review and is live for invites or briefs. `campaign.completed`: Every deal on the campaign is terminal and escrow is settled. `campaign.cancelled`: Campaign was cancelled before or during flight. `campaign.budget_threshold`: Spend crossed a configured budget threshold. `deal.accepted`: Creator accepted; escrow hold is in progress or complete. `deal.declined`: Creator declined an invite or offer. `deal.expired`: Offer TTL elapsed without accept. `deal.status_changed`: Deal moved to another status (content, live, verifying, ...). `deal.completed`: Deal finished after release or full refund. `deal.cancelled`: Deal was cancelled; escrow refunds per rules. `deal.disputed`: A dispute opened; settlement is paused. `content.submitted`: Creator submitted draft content for brand review. `placement.submitted`: Live post URL submitted for verification. `placement.verified`: Placement passed verification checks. `placement.metrics_updated`: Views, clicks, or engagements were updated. Payload may include measurementMode (api | link | hybrid); link platforms do not invent impressions. `escrow.held`: Funds moved from available into escrow for a deal. `escrow.released`: Earned funds released to the creator pending-unlock bucket. `escrow.refunded`: Unused escrow returned to the brand. `verification.completed`: Verification run finished for a placement or deal. `dispute.resolved`: Trust & Safety closed a dispute. `conversion.recorded`: Your postback created a new conversion. Replays do not re-fire this event. `webhook.test`: Ping from send-test. Use it to verify signature handling."
      },
      "CreateApiKeyRequest": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 80,
            "example": "Production"
          },
          "scopes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiKeyScope"
            },
            "description": "Omit to store `[\"read\"]` only.",
            "example": [
              "read",
              "write"
            ]
          }
        }
      },
      "RegisterWebhookRequest": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "example": "https://api.example.com/pactreach/webhooks"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEventName"
            },
            "description": "Omit for the default: deal.completed and conversion.recorded."
          }
        }
      },
      "UpdateWebhookRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEventName"
            }
          },
          "isActive": {
            "type": "boolean",
            "description": "Re-enabling also clears the failure counter that switched the endpoint off."
          }
        }
      },
      "ConversionPostbackRequest": {
        "type": "object",
        "required": [
          "eventType"
        ],
        "properties": {
          "eventType": {
            "type": "string",
            "description": "Your label, for example purchase, lead, or signup.",
            "example": "purchase"
          },
          "clickId": {
            "type": "string",
            "example": "clk_01JEXAMPLE"
          },
          "linkCode": {
            "type": "string",
            "description": "Short code from the tracked URL. Must belong to this brand when it matches.",
            "example": "ab12cd"
          },
          "valueMinor": {
            "type": "integer",
            "description": "Integer minor units (kobo / cents). Defaults to 0. Never a decimal string.",
            "example": 150000
          },
          "currency": {
            "type": "string",
            "enum": [
              "NGN",
              "USD"
            ],
            "default": "NGN"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "description": "Opaque JSON for your own ids. Do not put secrets here.",
            "example": {
              "orderId": "99102"
            }
          }
        }
      },
      "WebhookDeliveryPayload": {
        "type": "object",
        "required": [
          "event",
          "data",
          "deliveryId",
          "sentAt"
        ],
        "properties": {
          "event": {
            "$ref": "#/components/schemas/WebhookEventName"
          },
          "data": {
            "type": "object",
            "additionalProperties": true
          },
          "deliveryId": {
            "type": "string"
          },
          "sentAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    }
  }
}
