{
  "openapi": "3.1.0",
  "info": {
    "title": "TrimLynk Developer API v1",
    "version": "1.3.0",
    "description": "TrimLynk is a modern, privacy-first URL shortening and link intelligence platform. This API provides programmatic access to link shortening, custom QR code generation, click analytics, geo-targeting, and Link-in-Bio management.\n\n### API Versioning Policy\nTrimLynk adopts URL path versioning (/v1/...). Clients are encouraged to target versioned endpoints (https://api.trimlynk.com/v1 or https://trimlynk.com/api/v1). Unversioned paths (/api/...) operate as aliases to /v1/... for 100% backward compatibility.\n\n### Developer API v1 Hardened Contract\nTrimLynk Developer API (`/api/v1/developer/*`) is a production-grade, hardened REST API supporting:\n- **Authentication**: Bearer API keys (`tl_live_...` or `tl_test_...`) or `x-api-key` header.\n- **Granular Scopes**: `links:read`, `links:write`, `analytics:read`, `conversions:read`, `conversions:write`, `campaigns:read`, `campaigns:write`, `webhooks:read`, `webhooks:write`.\n- **Request Tracing**: All requests return `X-Request-Id` in response headers and inside all error/success envelopes. Clients may provide their own `X-Request-Id`.\n- **API Version Header**: All Developer API responses include `X-Trimlynk-API-Version: 1`.\n- **Idempotency**: Mutating endpoints (`POST /links`, `POST /campaigns`, `POST /webhooks`) accept an optional `Idempotency-Key` header. Duplicate requests return cached responses with header `Idempotent-Replay: true`. Mismatched bodies return HTTP 409 `idempotency_conflict`.\n- **Standardized Pagination**: List endpoints use `?page=1&limit=50` (maximum: 100) and return `{ data: [...], pagination: { page, limit, total, totalPages }, requestId }`.\n- **Standard Error Envelopes**: All Developer API errors return `{ error: { code, message, details? }, requestId }` with taxonomy codes: `invalid_request`, `validation_error`, `invalid_api_key`, `insufficient_scope`, `not_found`, `conflict`, `idempotency_conflict`, `rate_limit_exceeded`, `internal_error`.\n\n### Deprecation & Sunset Policy\nWhen an endpoint or API version is scheduled for deprecation, TrimLynk signals this via standard RFC 8594 / RFC 9285 response headers:\n- `Deprecation: true` (or `@<timestamp>`)\n- `Sunset: <HTTP-date>`\n- `Link: <documentation-url>; rel=\"deprecation\"`\n\n### Rate Limiting & Response Headers\nAll API endpoints return standard IETF RateLimit headers:\n- `RateLimit-Limit`: Request limit quota per window\n- `RateLimit-Remaining`: Remaining request allowance\n- `RateLimit-Reset`: Seconds until quota reset\n- `Retry-After`: Number of seconds to wait before retrying (returned on HTTP 429 status)",
    "contact": {
      "name": "TrimLynk Support",
      "email": "support@trimlynk.com",
      "url": "https://trimlynk.com/contact"
    },
    "license": {
      "name": "TrimLynk Terms of Service",
      "url": "https://trimlynk.com/terms"
    }
  },
  "servers": [
    {
      "url": "https://api.trimlynk.com",
      "description": "Primary Production API Subdomain"
    },
    {
      "url": "https://trimlynk.com",
      "description": "Root Production Domain"
    },
    {
      "url": "http://localhost:3001",
      "description": "Local Development Server"
    }
  ],
  "tags": [
    {
      "name": "Links",
      "description": "Create, list, update, and delete shortened links"
    },
    {
      "name": "Analytics",
      "description": "Aggregate workspace, per-link, and conversion funnel analytics"
    },
    {
      "name": "Conversions",
      "description": "Record and query attributed conversion events"
    },
    {
      "name": "Campaigns",
      "description": "Manage marketing campaigns"
    },
    {
      "name": "Webhooks",
      "description": "Register webhook endpoints, test pings, and inspect/retry deliveries"
    }
  ],
  "paths": {
    "/api/v1/developer/links": {
      "get": {
        "operationId": "developerListLinks",
        "summary": "List shortened links",
        "description": "Retrieve paginated links for the authenticated workspace. Requires `links:read` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            },
            "description": "Page number"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 100
            },
            "description": "Items per page (max 100)"
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Search title, shortCode, or originalUrl"
          },
          {
            "name": "tag",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter by tag"
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "latest",
                "oldest",
                "clicks",
                "title"
              ],
              "default": "latest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of links",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "pagination",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DeveloperLink"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/PaginationMetadata"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Links"
        ]
      },
      "post": {
        "operationId": "developerCreateLink",
        "summary": "Create a shortened link",
        "description": "Creates a new shortened URL with optional custom slug, tags, and UTM tags. Supports idempotency via `Idempotency-Key` header. Requires `links:write` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKeyHeader"
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "originalUrl"
                ],
                "properties": {
                  "originalUrl": {
                    "type": "string",
                    "format": "uri",
                    "example": "https://example.com/summer-sale"
                  },
                  "customSlug": {
                    "type": "string",
                    "example": "summer-sale"
                  },
                  "title": {
                    "type": "string",
                    "example": "Summer Campaign"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "example": [
                      "summer",
                      "promo"
                    ]
                  },
                  "utmSource": {
                    "type": "string",
                    "example": "newsletter"
                  },
                  "utmMedium": {
                    "type": "string",
                    "example": "email"
                  },
                  "utmCampaign": {
                    "type": "string",
                    "example": "summer2026"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Link created successfully (or replayed from idempotent cache)",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              },
              "Idempotent-Replay": {
                "description": "Present and set to \"true\" when returning a previously cached response",
                "schema": {
                  "type": "string",
                  "example": "true"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DeveloperLink"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Links"
        ]
      }
    },
    "/api/v1/developer/links/{id}": {
      "get": {
        "operationId": "developerGetLink",
        "summary": "Get link details",
        "description": "Retrieve detailed information for a single link. Requires `links:read` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Link ID"
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Link details",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DeveloperLink"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Links"
        ]
      },
      "patch": {
        "operationId": "developerUpdateLink",
        "summary": "Update link",
        "description": "Update destination URL, title, tags, or active status. Requires `links:write` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "originalUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "customSlug": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "utmSource": {
                    "type": "string"
                  },
                  "utmMedium": {
                    "type": "string"
                  },
                  "utmCampaign": {
                    "type": "string"
                  },
                  "isActive": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Link updated",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DeveloperLink"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Links"
        ]
      },
      "delete": {
        "operationId": "developerDeleteLink",
        "summary": "Delete link",
        "description": "Deletes a shortened link. Requires `links:write` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Link deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "deleted": {
                          "type": "boolean",
                          "example": true
                        }
                      }
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Links"
        ]
      }
    },
    "/api/v1/developer/analytics": {
      "get": {
        "operationId": "developerGetAnalytics",
        "summary": "Get aggregate workspace analytics",
        "description": "Retrieve clicks, unique visitors, devices, countries, and referrers. Requires `analytics:read` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "startDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "urlId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Aggregate analytics summary",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Analytics"
        ]
      }
    },
    "/api/v1/developer/analytics/conversions": {
      "get": {
        "operationId": "developerGetFunnelAnalytics",
        "summary": "Get conversion funnel metrics",
        "description": "Retrieve Click -> Lead -> Sale conversion funnel metrics and total revenue. Requires `conversions:read` or `analytics:read` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "urlId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Conversion funnel analytics",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Analytics"
        ]
      }
    },
    "/api/v1/developer/conversions": {
      "get": {
        "operationId": "developerListConversions",
        "summary": "List conversion events",
        "description": "Retrieve paginated conversion events for the workspace. Requires `conversions:read` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "eventName",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "urlId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated conversions list",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "pagination",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DeveloperConversion"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/PaginationMetadata"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Conversions"
        ]
      },
      "post": {
        "operationId": "developerCreateConversion",
        "summary": "Record a conversion event",
        "description": "Records a conversion event against a link. Requires `conversions:write` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "urlId",
                  "eventName"
                ],
                "properties": {
                  "urlId": {
                    "type": "string",
                    "example": "clk1a2b3c4d5"
                  },
                  "eventName": {
                    "type": "string",
                    "example": "purchase"
                  },
                  "eventValue": {
                    "type": "number",
                    "example": 49.99
                  },
                  "currency": {
                    "type": "string",
                    "example": "USD"
                  },
                  "customerId": {
                    "type": "string",
                    "example": "cust_123"
                  },
                  "orderId": {
                    "type": "string",
                    "example": "ord_456"
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Conversion already recorded (deduplicated replay or idempotent replay)",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              },
              "Idempotent-Replay": {
                "description": "Indicates whether this response is an idempotent replay",
                "schema": {
                  "type": "string",
                  "example": "true"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DeveloperConversion"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Conversion recorded",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DeveloperConversion"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Conversions"
        ]
      }
    },
    "/api/v1/developer/campaigns": {
      "get": {
        "operationId": "developerListCampaigns",
        "summary": "List marketing campaigns",
        "description": "Retrieve paginated marketing campaigns. Requires `campaigns:read` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of campaigns",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "pagination",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DeveloperCampaign"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/PaginationMetadata"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Campaigns"
        ]
      },
      "post": {
        "operationId": "developerCreateCampaign",
        "summary": "Create marketing campaign",
        "description": "Create a new marketing campaign. Supports idempotency via `Idempotency-Key` header. Requires `campaigns:write` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKeyHeader"
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "example": "Q3 Growth"
                  },
                  "description": {
                    "type": "string",
                    "example": "Campaign for Q3 expansion"
                  },
                  "utmSource": {
                    "type": "string",
                    "example": "newsletter"
                  },
                  "utmMedium": {
                    "type": "string",
                    "example": "email"
                  },
                  "utmCampaign": {
                    "type": "string",
                    "example": "q3_growth"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Campaign created",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              },
              "Idempotent-Replay": {
                "description": "Present and set to \"true\" when returning a previously cached response",
                "schema": {
                  "type": "string",
                  "example": "true"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DeveloperCampaign"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Campaigns"
        ]
      }
    },
    "/api/v1/developer/webhooks": {
      "get": {
        "operationId": "developerListWebhooks",
        "summary": "List webhooks",
        "description": "Retrieve paginated webhooks registered for the workspace. Requires `webhooks:read` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of webhooks",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "pagination",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DeveloperWebhook"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/PaginationMetadata"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Webhooks"
        ]
      },
      "post": {
        "operationId": "developerCreateWebhook",
        "summary": "Register webhook endpoint",
        "description": "Registers a new webhook URL and subscribes to events. Supports idempotency via `Idempotency-Key` header. Requires `webhooks:write` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKeyHeader"
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url",
                  "events"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "example": "https://api.example.com/webhooks"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "example": [
                      "link.created",
                      "click.recorded"
                    ]
                  },
                  "description": {
                    "type": "string",
                    "example": "Production Webhook"
                  },
                  "secret": {
                    "type": "string",
                    "example": "custom_signing_secret_optional"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Webhook created with secret",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              },
              "Idempotent-Replay": {
                "description": "Present and set to \"true\" when returning a previously cached response",
                "schema": {
                  "type": "string",
                  "example": "true"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DeveloperWebhook"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/api/v1/developer/analytics/links/{id}": {
      "get": {
        "operationId": "developerGetLinkAnalytics",
        "summary": "Get analytics for a specific link",
        "description": "Retrieve click metrics, browser breakdown, and geo data for a single link. Requires `analytics:read` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Link analytics summary",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Analytics"
        ]
      }
    },
    "/api/v1/developer/conversions/{id}": {
      "get": {
        "operationId": "developerGetConversion",
        "summary": "Get conversion details",
        "description": "Retrieve details of a single conversion event. Requires `conversions:read` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Conversion event details",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DeveloperConversion"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Conversions"
        ]
      }
    },
    "/api/v1/developer/campaigns/{id}": {
      "get": {
        "operationId": "developerGetCampaign",
        "summary": "Get campaign details",
        "description": "Retrieve details for a single campaign. Requires `campaigns:read` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Campaign details",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DeveloperCampaign"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Campaigns"
        ]
      },
      "patch": {
        "operationId": "developerUpdateCampaign",
        "summary": "Update campaign",
        "description": "Update campaign properties. Requires `campaigns:write` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "utmSource": {
                    "type": "string"
                  },
                  "utmMedium": {
                    "type": "string"
                  },
                  "utmCampaign": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Campaign updated",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DeveloperCampaign"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Campaigns"
        ]
      },
      "delete": {
        "operationId": "developerDeleteCampaign",
        "summary": "Delete campaign",
        "description": "Deletes a campaign. Requires `campaigns:write` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Campaign deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "deleted": {
                          "type": "boolean",
                          "example": true
                        }
                      }
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Campaigns"
        ]
      }
    },
    "/api/v1/developer/webhooks/{id}": {
      "get": {
        "operationId": "developerGetWebhook",
        "summary": "Get webhook details",
        "description": "Retrieve details for a single webhook. Requires `webhooks:read` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook details",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DeveloperWebhook"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Webhooks"
        ]
      },
      "patch": {
        "operationId": "developerUpdateWebhook",
        "summary": "Update webhook",
        "description": "Update destination URL, event subscriptions, or active status. Requires `webhooks:write` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "description": {
                    "type": "string"
                  },
                  "isActive": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook updated",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DeveloperWebhook"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Webhooks"
        ]
      },
      "delete": {
        "operationId": "developerDeleteWebhook",
        "summary": "Delete webhook",
        "description": "Deletes a registered webhook. Requires `webhooks:write` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook deleted",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "deleted": {
                          "type": "boolean",
                          "example": true
                        }
                      }
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/api/v1/developer/webhooks/{id}/test": {
      "post": {
        "operationId": "developerTestWebhook",
        "summary": "Trigger test webhook delivery",
        "description": "Dispatches a test `ping` event delivery to the webhook endpoint. Requires `webhooks:write` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Test dispatch initiated",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/api/v1/developer/webhooks/{id}/deliveries": {
      "get": {
        "operationId": "developerListWebhookDeliveries",
        "summary": "List delivery history for a webhook",
        "description": "Retrieve paginated delivery attempts for a webhook. Requires `webhooks:read` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated webhook delivery logs",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "pagination",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/PaginationMetadata"
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/api/v1/developer/webhooks/{id}/deliveries/{deliveryId}/retry": {
      "post": {
        "operationId": "developerRetryWebhookDelivery",
        "summary": "Retry a webhook delivery",
        "description": "Retries a previously failed webhook delivery attempt, preserving the original event payload with a freshly computed HMAC signature. Requires `webhooks:write` scope.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Unique webhook identifier"
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Unique delivery log identifier"
          },
          {
            "$ref": "#/components/parameters/XRequestIdHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook delivery retry initiated",
            "headers": {
              "X-Request-Id": {
                "description": "Unique request tracing identifier",
                "schema": {
                  "type": "string",
                  "example": "req_01k12abc89def"
                }
              },
              "X-Trimlynk-API-Version": {
                "description": "TrimLynk Developer API major version contract",
                "schema": {
                  "type": "string",
                  "example": "1"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "requestId"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "requestId": {
                      "type": "string",
                      "example": "req_01k12abc89def"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DeveloperBadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/DeveloperUnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/DeveloperForbiddenError"
          },
          "404": {
            "$ref": "#/components/responses/DeveloperNotFoundError"
          },
          "409": {
            "$ref": "#/components/responses/DeveloperConflictError"
          },
          "429": {
            "$ref": "#/components/responses/DeveloperRateLimitError"
          },
          "500": {
            "$ref": "#/components/responses/DeveloperInternalError"
          }
        },
        "tags": [
          "Webhooks"
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key (tl_live_... or tl_test_...)",
        "description": "TrimLynk Developer API Key passed as Authorization: Bearer tl_live_..."
      },
      "ApiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Alternative header for TrimLynk Developer API Key"
      }
    },
    "schemas": {
      "ShortUrlResponse": {
        "type": "object",
        "properties": {
          "shortCode": {
            "type": "string",
            "example": "x8K2mQ"
          },
          "shortUrl": {
            "type": "string",
            "example": "https://trimlynk.com/x8K2mQ"
          },
          "longUrl": {
            "type": "string",
            "example": "https://example.com"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "UrlItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "cuid12345"
          },
          "title": {
            "type": "string",
            "example": "Landing Page"
          },
          "originalUrl": {
            "type": "string",
            "example": "https://example.com"
          },
          "shortUrl": {
            "type": "string",
            "example": "x8K2mQ"
          },
          "customUrl": {
            "type": "string",
            "nullable": true,
            "example": "promo"
          },
          "currentClicks": {
            "type": "integer",
            "example": 42
          },
          "isActive": {
            "type": "boolean",
            "example": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RedirectResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "originalUrl": {
            "type": "string",
            "nullable": true
          },
          "shortUrl": {
            "type": "string"
          },
          "hasPassword": {
            "type": "boolean"
          },
          "isExpired": {
            "type": "boolean"
          },
          "isActive": {
            "type": "boolean"
          }
        }
      },
      "ClickItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "urlId": {
            "type": "string"
          },
          "country": {
            "type": "string",
            "example": "US"
          },
          "device": {
            "type": "string",
            "example": "desktop"
          },
          "browser": {
            "type": "string",
            "example": "Chrome"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ApiKeyItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "example": "Production CLI Service"
          },
          "keyPreview": {
            "type": "string",
            "example": "tk_live_...9f81"
          },
          "isActive": {
            "type": "boolean",
            "example": true
          },
          "lastUsedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ApiKeyCreatedResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "key": {
            "type": "string",
            "example": "tk_live_a1b2c3d4e5f6g7h8i9j0"
          },
          "message": {
            "type": "string",
            "example": "Copy this key now. It will not be shown again."
          }
        }
      },
      "DynamicQrItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "shortCode": {
            "type": "string",
            "example": "qr_8K2m"
          },
          "targetUrl": {
            "type": "string",
            "example": "https://example.com/promo"
          },
          "scans": {
            "type": "integer",
            "example": 18
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AuthResponse": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
          },
          "user": {
            "$ref": "#/components/schemas/UserProfile"
          }
        }
      },
      "UserProfile": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "usr_123"
          },
          "name": {
            "type": "string",
            "example": "Alex Rivera"
          },
          "email": {
            "type": "string",
            "example": "alex@example.com"
          },
          "role": {
            "type": "string",
            "example": "USER"
          }
        }
      },
      "AnalyticsSummary": {
        "type": "object",
        "properties": {
          "totalClicks": {
            "type": "integer",
            "example": 150
          },
          "uniqueVisitors": {
            "type": "integer",
            "example": 110
          },
          "countryStats": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "country": {
                  "type": "string",
                  "example": "United States"
                },
                "count": {
                  "type": "integer",
                  "example": 60
                }
              }
            }
          },
          "deviceStats": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "device": {
                  "type": "string",
                  "example": "mobile"
                },
                "count": {
                  "type": "integer",
                  "example": 85
                }
              }
            }
          }
        }
      },
      "ErrorDetails": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "example": "INVALID_PARAMS"
          },
          "message": {
            "type": "string",
            "example": "The provided parameters are invalid."
          },
          "resolution": {
            "type": "string",
            "example": "Ensure longUrl is a valid HTTP or HTTPS URL."
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorDetails"
          },
          "message": {
            "type": "string",
            "example": "The provided parameters are invalid."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DeveloperApiError": {
        "type": "object",
        "required": [
          "error",
          "requestId"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "validation_error",
                  "invalid_api_key",
                  "insufficient_scope",
                  "not_found",
                  "conflict",
                  "idempotency_conflict",
                  "rate_limit_exceeded",
                  "internal_error"
                ],
                "example": "validation_error"
              },
              "message": {
                "type": "string",
                "example": "originalUrl is required"
              },
              "details": {
                "type": "object",
                "description": "Contextual error details or validation field violations",
                "additionalProperties": true,
                "example": {
                  "field": "originalUrl"
                }
              }
            }
          },
          "requestId": {
            "type": "string",
            "example": "req_01k12abc89def"
          }
        }
      },
      "PaginationMetadata": {
        "type": "object",
        "required": [
          "page",
          "limit",
          "total",
          "totalPages"
        ],
        "properties": {
          "page": {
            "type": "integer",
            "example": 1
          },
          "limit": {
            "type": "integer",
            "example": 50
          },
          "total": {
            "type": "integer",
            "example": 125
          },
          "totalPages": {
            "type": "integer",
            "example": 3
          }
        }
      },
      "DeveloperLink": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "clk1a2b3c4d5"
          },
          "shortCode": {
            "type": "string",
            "example": "summer-sale"
          },
          "shortUrl": {
            "type": "string",
            "example": "https://trimlynk.com/summer-sale"
          },
          "originalUrl": {
            "type": "string",
            "example": "https://example.com/summer"
          },
          "title": {
            "type": "string",
            "example": "Summer Campaign"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "summer",
              "promo"
            ]
          },
          "clicks": {
            "type": "integer",
            "example": 42
          },
          "isActive": {
            "type": "boolean",
            "example": true
          },
          "utmSource": {
            "type": "string",
            "example": "twitter"
          },
          "utmMedium": {
            "type": "string",
            "example": "social"
          },
          "utmCampaign": {
            "type": "string",
            "example": "launch"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DeveloperCampaign": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "cmp_01a2b3c4"
          },
          "name": {
            "type": "string",
            "example": "Q3 Growth"
          },
          "description": {
            "type": "string",
            "example": "Q3 Acquisition campaign"
          },
          "utmSource": {
            "type": "string",
            "example": "newsletter"
          },
          "utmMedium": {
            "type": "string",
            "example": "email"
          },
          "utmCampaign": {
            "type": "string",
            "example": "q3_growth"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DeveloperWebhook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "whk_01a2b3c4"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "example": "https://api.example.com/webhooks"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "link.created",
              "click.recorded"
            ]
          },
          "description": {
            "type": "string",
            "example": "Primary notification hook"
          },
          "isActive": {
            "type": "boolean",
            "example": true
          },
          "secret": {
            "type": "string",
            "example": "whsec_a1b2c3d4e5f6"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DeveloperConversion": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "cnv_01a2b3c4"
          },
          "urlId": {
            "type": "string",
            "example": "clk1a2b3c4d5"
          },
          "eventName": {
            "type": "string",
            "example": "purchase"
          },
          "eventValue": {
            "type": "number",
            "example": 49.99
          },
          "currency": {
            "type": "string",
            "example": "USD"
          },
          "customerId": {
            "type": "string",
            "example": "cust_123"
          },
          "orderId": {
            "type": "string",
            "example": "ord_456"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Integration": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "int_01k12abc89def"
          },
          "name": {
            "type": "string",
            "example": "Slack Alerts Channel"
          },
          "provider": {
            "type": "string",
            "enum": [
              "zapier",
              "make",
              "slack",
              "discord",
              "custom_webhook"
            ],
            "example": "slack"
          },
          "providerName": {
            "type": "string",
            "example": "Slack"
          },
          "category": {
            "type": "string",
            "example": "communication"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled",
              "error"
            ],
            "example": "active"
          },
          "config": {
            "type": "object",
            "description": "Provider-specific configuration with secrets masked",
            "properties": {
              "webhookUrl": {
                "type": "string",
                "example": "https://hooks.slack.com/services/T••••/B••••/••••"
              },
              "channel": {
                "type": "string",
                "example": "#sales-alerts"
              }
            }
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "sale.created",
              "lead.created",
              "click.created"
            ]
          },
          "lastDeliveryAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastErrorAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastErrorMessage": {
            "type": "string",
            "nullable": true
          },
          "failureCount": {
            "type": "integer",
            "example": 0
          },
          "totalDeliveries": {
            "type": "integer",
            "example": 42
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateIntegrationRequest": {
        "type": "object",
        "required": [
          "name",
          "provider",
          "config"
        ],
        "properties": {
          "name": {
            "type": "string",
            "example": "Production Slack Alerts"
          },
          "provider": {
            "type": "string",
            "enum": [
              "zapier",
              "make",
              "slack",
              "discord",
              "custom_webhook"
            ],
            "example": "custom_webhook"
          },
          "config": {
            "type": "object",
            "required": [
              "webhookUrl"
            ],
            "properties": {
              "webhookUrl": {
                "type": "string",
                "format": "uri",
                "example": "https://api.example.com/events"
              },
              "channel": {
                "type": "string",
                "example": "#marketing"
              },
              "secret": {
                "type": "string",
                "description": "Optional signing secret for Zapier/Make"
              },
              "signingSecret": {
                "type": "string",
                "description": "HMAC-SHA256 signing secret for custom webhooks"
              },
              "payloadMode": {
                "type": "string",
                "enum": [
                  "standard",
                  "flattened"
                ],
                "default": "standard"
              },
              "customHeaders": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                },
                "example": {
                  "X-Environment": "production"
                }
              }
            }
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "sale.created",
              "lead.created"
            ]
          }
        }
      },
      "UpdateIntegrationRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "Updated Integration Name"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled"
            ]
          },
          "config": {
            "type": "object"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "IntegrationDelivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "del_01k12abc89def"
          },
          "integrationId": {
            "type": "string",
            "example": "int_01k12abc89def"
          },
          "eventId": {
            "type": "string",
            "example": "evt_01k12abc89def"
          },
          "eventType": {
            "type": "string",
            "example": "sale.created"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "sending",
              "pending",
              "delivered",
              "retrying",
              "failed",
              "disabled"
            ],
            "example": "delivered"
          },
          "attempt": {
            "type": "integer",
            "example": 1
          },
          "responseStatus": {
            "type": "integer",
            "example": 200
          },
          "responseTimeMs": {
            "type": "integer",
            "example": 125
          },
          "durationMs": {
            "type": "integer",
            "example": 125
          },
          "errorMessage": {
            "type": "string",
            "nullable": true
          },
          "errorCategory": {
            "type": "string",
            "nullable": true,
            "example": "timeout"
          },
          "errorDescription": {
            "type": "string",
            "nullable": true,
            "example": "The request timed out waiting for the remote server."
          },
          "nextRetryAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "IntegrationDeliveryDetail": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "del_01k12abc89def"
          },
          "integrationId": {
            "type": "string",
            "example": "int_01k12abc89def"
          },
          "provider": {
            "type": "string",
            "example": "custom_webhook"
          },
          "eventId": {
            "type": "string",
            "example": "evt_01k12abc89def"
          },
          "eventType": {
            "type": "string",
            "example": "sale.created"
          },
          "status": {
            "type": "string",
            "example": "delivered"
          },
          "attempt": {
            "type": "integer",
            "example": 1
          },
          "responseStatus": {
            "type": "integer",
            "example": 200
          },
          "responseTimeMs": {
            "type": "integer",
            "example": 125
          },
          "durationMs": {
            "type": "integer",
            "example": 125
          },
          "errorMessage": {
            "type": "string",
            "nullable": true
          },
          "errorCategory": {
            "type": "string",
            "nullable": true
          },
          "errorDescription": {
            "type": "string",
            "nullable": true
          },
          "responseBodyPreview": {
            "type": "string",
            "nullable": true,
            "description": "Safe truncated response preview (max 2KB, credential-redacted)"
          },
          "requestHeaders": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Safe outbound headers with sensitive headers redacted"
          },
          "sanitizedPayload": {
            "type": "object",
            "description": "Sanitized outbound webhook payload"
          },
          "circuitBreakerActive": {
            "type": "boolean",
            "example": false
          },
          "nextRetryAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "IntegrationHealth": {
        "type": "object",
        "properties": {
          "integrationId": {
            "type": "string",
            "example": "int_01k12abc89def"
          },
          "name": {
            "type": "string",
            "example": "Production Webhook"
          },
          "provider": {
            "type": "string",
            "example": "custom_webhook"
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "degraded",
              "failing",
              "disabled",
              "never_tested"
            ],
            "example": "healthy"
          },
          "healthState": {
            "type": "string",
            "enum": [
              "Healthy",
              "Degraded",
              "Failing",
              "Disabled",
              "Never tested"
            ],
            "example": "Healthy"
          },
          "consecutiveFailures": {
            "type": "integer",
            "example": 0
          },
          "lastSuccessAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastFailureAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastFailureReason": {
            "type": "string",
            "nullable": true
          },
          "circuitBreaker": {
            "type": "object",
            "properties": {
              "paused": {
                "type": "boolean",
                "example": false
              },
              "pausedAt": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "pausedUntil": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "cooldownSecondsRemaining": {
                "type": "integer",
                "example": 0
              },
              "pauseReason": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "recommendations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "IntegrationMetrics": {
        "type": "object",
        "properties": {
          "integrationId": {
            "type": "string",
            "example": "int_01k12abc89def"
          },
          "provider": {
            "type": "string",
            "example": "custom_webhook"
          },
          "range": {
            "type": "string",
            "enum": [
              "24h",
              "7d",
              "30d",
              "90d"
            ],
            "example": "7d"
          },
          "totalDeliveries": {
            "type": "integer",
            "example": 1240
          },
          "successfulDeliveries": {
            "type": "integer",
            "example": 1235
          },
          "failedDeliveries": {
            "type": "integer",
            "example": 5
          },
          "retryingDeliveries": {
            "type": "integer",
            "example": 0
          },
          "retryCount": {
            "type": "integer",
            "example": 2
          },
          "successRate": {
            "type": "number",
            "example": 99.6
          },
          "avgLatencyMs": {
            "type": "integer",
            "example": 142
          },
          "p50LatencyMs": {
            "type": "integer",
            "example": 120
          },
          "p95LatencyMs": {
            "type": "integer",
            "example": 310
          },
          "p99LatencyMs": {
            "type": "integer",
            "example": 540
          }
        }
      },
      "OAuthProviderItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "slack"
          },
          "name": {
            "type": "string",
            "example": "Slack"
          },
          "category": {
            "type": "string",
            "example": "communication"
          },
          "description": {
            "type": "string",
            "example": "Send real-time alerts and notifications to Slack channels"
          },
          "authType": {
            "type": "string",
            "example": "oauth"
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "oauth",
              "blocks_formatting"
            ]
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "chat:write",
              "channels:read"
            ]
          },
          "permissions": {
            "type": "object",
            "properties": {
              "canDo": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "example": [
                  "Post notifications to designated channels"
                ]
              },
              "cannotDo": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "example": [
                  "Read private messages or history"
                ]
              }
            }
          },
          "isConfigured": {
            "type": "boolean",
            "example": true
          },
          "documentationUrl": {
            "type": "string",
            "example": "https://docs.trimlynk.com/integrations/slack"
          }
        }
      },
      "OAuthStartRequest": {
        "type": "object",
        "properties": {
          "returnUrl": {
            "type": "string",
            "description": "Internal relative return URL after auth completes",
            "example": "/developers/integrations/slack"
          }
        }
      },
      "OAuthStartResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "authorizationUrl": {
            "type": "string",
            "example": "https://slack.com/oauth/v2/authorize?client_id=...&state=..."
          },
          "state": {
            "type": "string",
            "example": "b4a8e2...32byte_hex"
          }
        }
      },
      "OAuthConnection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "cmufsabc001"
          },
          "name": {
            "type": "string",
            "example": "Marketing Slack Alerts"
          },
          "provider": {
            "type": "string",
            "example": "slack"
          },
          "providerName": {
            "type": "string",
            "example": "Slack"
          },
          "category": {
            "type": "string",
            "example": "communication"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled",
              "error",
              "authentication_required"
            ],
            "example": "active"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "click.created",
              "sale.created"
            ]
          },
          "connection": {
            "type": "object",
            "properties": {
              "isConnected": {
                "type": "boolean",
                "example": true
              },
              "accountId": {
                "type": "string",
                "example": "T012345678"
              },
              "accountName": {
                "type": "string",
                "example": "Acme Corp"
              },
              "tokenType": {
                "type": "string",
                "example": "Bearer"
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              },
              "lastRefreshAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "totalDeliveries": {
            "type": "integer",
            "example": 128
          },
          "lastDeliveryAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OAuthDisconnectResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "message": {
            "type": "string",
            "example": "Successfully disconnected Slack"
          }
        }
      },
      "OAuthError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "oauth_state_invalid",
                  "oauth_state_expired",
                  "oauth_denied",
                  "oauth_code_exchange_failed",
                  "oauth_token_refresh_failed",
                  "oauth_connection_revoked",
                  "provider_unavailable",
                  "missing_provider_configuration"
                ],
                "example": "oauth_state_expired"
              },
              "message": {
                "type": "string",
                "example": "OAuth state parameter has expired. Please initiate connection again."
              }
            }
          }
        }
      },
      "IntegrationAction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "act_01k12abc89def"
          },
          "teamId": {
            "type": "string",
            "nullable": true,
            "example": "team_01k12"
          },
          "integrationId": {
            "type": "string",
            "example": "int_01k12abc89def"
          },
          "name": {
            "type": "string",
            "example": "Slack High Value Sale Alert"
          },
          "description": {
            "type": "string",
            "nullable": true,
            "example": "Sends message to #sales for orders >= $100"
          },
          "enabled": {
            "type": "boolean",
            "example": true
          },
          "actionType": {
            "type": "string",
            "example": "send_message"
          },
          "eventTypes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "sale.created",
              "conversion.created"
            ]
          },
          "filters": {
            "type": "object",
            "example": {
              "campaignId": "summer-sale",
              "revenue": {
                "gte": 100
              }
            }
          },
          "configuration": {
            "type": "object",
            "example": {
              "channel": "#sales",
              "message": "🎉 Sale: {{event.conversion.amount}}"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateIntegrationActionRequest": {
        "type": "object",
        "required": [
          "name",
          "integrationId",
          "actionType"
        ],
        "properties": {
          "name": {
            "type": "string",
            "example": "Slack High Value Alert"
          },
          "description": {
            "type": "string",
            "example": "Alerts #sales on high-tier sales"
          },
          "integrationId": {
            "type": "string",
            "example": "int_01k12abc89def"
          },
          "actionType": {
            "type": "string",
            "example": "send_message"
          },
          "eventTypes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "sale.created"
            ]
          },
          "filters": {
            "type": "object",
            "example": {
              "revenue": {
                "gte": 100
              }
            }
          },
          "configuration": {
            "type": "object",
            "example": {
              "channel": "#sales",
              "message": "🎉 Sale: {{event.conversion.amount}}"
            }
          },
          "enabled": {
            "type": "boolean",
            "default": true
          }
        }
      },
      "UpdateIntegrationActionRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "eventTypes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "filters": {
            "type": "object"
          },
          "configuration": {
            "type": "object"
          }
        }
      },
      "IntegrationActionTestResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "data": {
            "type": "object",
            "properties": {
              "success": {
                "type": "boolean",
                "example": true
              },
              "durationMs": {
                "type": "integer",
                "example": 142
              },
              "provider": {
                "type": "string",
                "example": "slack"
              },
              "actionType": {
                "type": "string",
                "example": "send_message"
              },
              "status": {
                "type": "integer",
                "example": 200
              }
            }
          }
        }
      },
      "IntegrationActionMetrics": {
        "type": "object",
        "properties": {
          "totalDeliveries": {
            "type": "integer",
            "example": 1284
          },
          "successfulDeliveries": {
            "type": "integer",
            "example": 1276
          },
          "failedDeliveries": {
            "type": "integer",
            "example": 8
          },
          "retryingDeliveries": {
            "type": "integer",
            "example": 0
          },
          "successRate": {
            "type": "number",
            "example": 99.4
          },
          "averageLatency": {
            "type": "integer",
            "example": 142
          },
          "consecutiveFailures": {
            "type": "integer",
            "example": 0
          },
          "lastDelivery": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastFailure": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "IntegrationResource": {
        "type": "object",
        "required": [
          "id",
          "name",
          "type"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "C123456"
          },
          "name": {
            "type": "string",
            "example": "sales-notifications"
          },
          "type": {
            "type": "string",
            "example": "public"
          },
          "isPrivate": {
            "type": "boolean",
            "example": false
          },
          "membershipType": {
            "type": "string",
            "example": "standard"
          },
          "rowCount": {
            "type": "integer",
            "example": 1000
          },
          "columnCount": {
            "type": "integer",
            "example": 26
          },
          "modifiedTime": {
            "type": "string",
            "example": "2026-09-24T18:00:00Z"
          },
          "fieldType": {
            "type": "string",
            "example": "text"
          },
          "required": {
            "type": "boolean",
            "example": false
          },
          "metadata": {
            "type": "object"
          }
        }
      },
      "ResourcePagination": {
        "type": "object",
        "properties": {
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "example": "eyJjdXJzb3IiOjEwMH0="
          },
          "hasMore": {
            "type": "boolean",
            "example": false
          }
        }
      },
      "IntegrationResourceList": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "resourceType": {
            "type": "string",
            "example": "channels"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationResource"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/ResourcePagination"
          }
        }
      },
      "IntegrationMapping": {
        "type": "array",
        "description": "List of destination field to source template variable mappings",
        "items": {
          "type": "object",
          "required": [
            "destination",
            "source"
          ],
          "properties": {
            "destination": {
              "type": "string",
              "description": "Target column name, property key, or field identifier",
              "example": "Revenue"
            },
            "source": {
              "type": "string",
              "description": "Source template expression, e.g. {{event.conversion.amount}}",
              "example": "{{event.conversion.amount}}"
            }
          }
        }
      },
      "ResourceUnavailableError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "example": "resource_unavailable"
          },
          "message": {
            "type": "string",
            "example": "The selected spreadsheet or worksheet could not be found."
          },
          "code": {
            "type": "string",
            "enum": [
              "resource_not_found",
              "permission_denied",
              "authentication_required",
              "provider_rate_limited",
              "provider_unavailable",
              "validation_error",
              "unknown"
            ],
            "example": "resource_not_found"
          }
        }
      },
      "IntegrationWorkflow": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "clwf_01k12abc89def"
          },
          "teamId": {
            "type": "string",
            "nullable": true,
            "example": "team_01k12"
          },
          "userId": {
            "type": "string",
            "example": "usr_01k12abc"
          },
          "name": {
            "type": "string",
            "example": "High Value Sale Multi-Sync"
          },
          "description": {
            "type": "string",
            "nullable": true,
            "example": "Alerts Slack, appends Google Sheets, and updates CRM"
          },
          "enabled": {
            "type": "boolean",
            "example": true
          },
          "triggerEvents": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "sale.created"
            ]
          },
          "conditions": {
            "type": "object",
            "properties": {
              "matchType": {
                "type": "string",
                "enum": [
                  "ALL",
                  "ANY"
                ],
                "example": "ALL"
              },
              "rules": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "field": {
                      "type": "string",
                      "example": "event.conversion.amount"
                    },
                    "operator": {
                      "type": "string",
                      "enum": [
                        "eq",
                        "neq",
                        "gt",
                        "gte",
                        "lt",
                        "lte",
                        "contains",
                        "in"
                      ],
                      "example": "gte"
                    },
                    "value": {
                      "example": 1000
                    }
                  }
                }
              }
            }
          },
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationWorkflowStep"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "IntegrationWorkflowStep": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "clwfs_01k12step1"
          },
          "workflowId": {
            "type": "string",
            "example": "clwf_01k12abc89def"
          },
          "actionId": {
            "type": "string",
            "example": "act_01k12abc89def"
          },
          "position": {
            "type": "integer",
            "example": 0
          },
          "enabled": {
            "type": "boolean",
            "example": true
          },
          "conditions": {
            "type": "object",
            "nullable": true
          },
          "action": {
            "$ref": "#/components/schemas/IntegrationAction"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "IntegrationWorkflowExecution": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "clwfe_01k12exec1"
          },
          "workflowId": {
            "type": "string",
            "example": "clwf_01k12abc89def"
          },
          "eventId": {
            "type": "string",
            "example": "evt_01k12abc"
          },
          "eventType": {
            "type": "string",
            "example": "sale.created"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "completed",
              "partially_completed",
              "failed",
              "skipped"
            ],
            "example": "completed"
          },
          "depth": {
            "type": "integer",
            "example": 1
          },
          "error": {
            "type": "string",
            "nullable": true
          },
          "stepResults": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "stepId": {
                  "type": "string"
                },
                "actionId": {
                  "type": "string"
                },
                "position": {
                  "type": "integer"
                },
                "provider": {
                  "type": "string",
                  "example": "slack"
                },
                "actionType": {
                  "type": "string",
                  "example": "send_channel_message"
                },
                "status": {
                  "type": "string",
                  "example": "delivered"
                },
                "responseStatus": {
                  "type": "integer",
                  "example": 200
                },
                "durationMs": {
                  "type": "integer",
                  "example": 142
                },
                "error": {
                  "type": "string",
                  "nullable": true
                }
              }
            }
          },
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateWorkflowRequest": {
        "type": "object",
        "required": [
          "name",
          "triggerEvents",
          "steps"
        ],
        "properties": {
          "name": {
            "type": "string",
            "example": "High Value Sale Multi-Sync"
          },
          "description": {
            "type": "string",
            "example": "Notify team and sync CRM"
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "triggerEvents": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "sale.created"
            ]
          },
          "conditions": {
            "type": "object",
            "properties": {
              "matchType": {
                "type": "string",
                "enum": [
                  "ALL",
                  "ANY"
                ],
                "example": "ALL"
              },
              "rules": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "field",
                    "operator",
                    "value"
                  ],
                  "properties": {
                    "field": {
                      "type": "string",
                      "example": "event.conversion.amount"
                    },
                    "operator": {
                      "type": "string",
                      "enum": [
                        "eq",
                        "neq",
                        "gt",
                        "gte",
                        "lt",
                        "lte",
                        "contains",
                        "in"
                      ],
                      "example": "gte"
                    },
                    "value": {
                      "example": 1000
                    }
                  }
                }
              }
            }
          },
          "steps": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "type": "object",
              "required": [
                "actionId"
              ],
              "properties": {
                "actionId": {
                  "type": "string",
                  "example": "act_01k12abc89def"
                },
                "position": {
                  "type": "integer",
                  "example": 0
                },
                "enabled": {
                  "type": "boolean",
                  "default": true
                }
              }
            }
          }
        }
      },
      "UpdateWorkflowRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "triggerEvents": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "conditions": {
            "type": "object"
          },
          "steps": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "type": "object",
              "properties": {
                "actionId": {
                  "type": "string"
                },
                "position": {
                  "type": "integer"
                },
                "enabled": {
                  "type": "boolean"
                }
              }
            }
          }
        }
      },
      "WorkflowRun": {
        "$ref": "#/components/schemas/IntegrationWorkflowExecution"
      },
      "WorkflowMetrics": {
        "type": "object",
        "properties": {
          "totalRuns": {
            "type": "integer",
            "example": 248
          },
          "completed": {
            "type": "integer",
            "example": 240
          },
          "partiallyCompleted": {
            "type": "integer",
            "example": 6
          },
          "failed": {
            "type": "integer",
            "example": 2
          },
          "skipped": {
            "type": "integer",
            "example": 14
          },
          "successRate": {
            "type": "number",
            "example": 96.8
          },
          "averageDurationMs": {
            "type": "integer",
            "example": 164
          }
        }
      },
      "WorkflowTemplate": {
        "type": "object",
        "required": [
          "id",
          "version",
          "name",
          "description",
          "category",
          "triggerEvents",
          "requiredProviders",
          "steps"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "high_value_sale_alert"
          },
          "version": {
            "type": "integer",
            "example": 1
          },
          "name": {
            "type": "string",
            "example": "High-Value Sale Alert"
          },
          "description": {
            "type": "string",
            "example": "Alert the sales team on Slack whenever a sale exceeds a customizable revenue threshold."
          },
          "category": {
            "type": "string",
            "example": "Sales"
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "icon": {
            "type": "string",
            "example": "slack"
          },
          "triggerEvents": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "sale.created"
            ]
          },
          "requiredProviders": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "slack"
            ]
          },
          "requiredCapabilities": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "provider": {
                  "type": "string"
                },
                "actionType": {
                  "type": "string"
                }
              }
            }
          },
          "configurationSchema": {
            "type": "object"
          },
          "conditions": {
            "type": "object",
            "nullable": true
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "position": {
                  "type": "integer"
                },
                "provider": {
                  "type": "string"
                },
                "actionType": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "defaultConfig": {
                  "type": "object"
                }
              }
            }
          },
          "recommended": {
            "type": "boolean",
            "description": "Calculated dynamically: true if caller workspace has all required providers connected"
          }
        }
      },
      "InstallWorkflowTemplateRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Custom workflow name (defaults to template name)",
            "example": "My High-Value Sale Alert"
          },
          "description": {
            "type": "string",
            "description": "Custom workflow description"
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "configuration": {
            "type": "object",
            "description": "Template-specific configuration parameters matching configurationSchema",
            "example": {
              "threshold": 100
            }
          },
          "resources": {
            "type": "object",
            "description": "Destination resources (slackChannelId, spreadsheetId, worksheetName, teamsChannelId, etc.)",
            "example": {
              "slackChannelId": "#vip-sales"
            }
          },
          "stepIntegrations": {
            "type": "object",
            "description": "Mapping of step position (or provider name) to connected integrationId",
            "example": {
              "0": "clintg_01k12slack"
            }
          },
          "stepActions": {
            "type": "object",
            "description": "Optional mapping of step position to an existing actionId to reuse",
            "example": {
              "0": "act_01k12existing"
            }
          }
        }
      },
      "IntegrationWorkflowVersion": {
        "type": "object",
        "required": [
          "id",
          "workflowId",
          "version",
          "status",
          "name",
          "triggerEvents",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "workflowId": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "example": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "published",
              "archived"
            ],
            "example": "published"
          },
          "name": {
            "type": "string",
            "example": "High Value Sale Sync"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "triggerEvents": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "sale.created"
            ]
          },
          "conditions": {
            "type": "object",
            "nullable": true
          },
          "configuration": {
            "type": "object",
            "nullable": true
          },
          "createdBy": {
            "type": "string",
            "nullable": true
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationWorkflowVersionStep"
            }
          }
        }
      },
      "IntegrationWorkflowVersionStep": {
        "type": "object",
        "required": [
          "id",
          "versionId",
          "actionId",
          "position",
          "enabled"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "versionId": {
            "type": "string"
          },
          "actionId": {
            "type": "string"
          },
          "position": {
            "type": "integer",
            "example": 0
          },
          "enabled": {
            "type": "boolean",
            "example": true
          },
          "conditions": {
            "type": "object",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "action": {
            "type": "object"
          }
        }
      },
      "WorkflowVersionComparison": {
        "type": "object",
        "required": [
          "fromVersion",
          "toVersion",
          "triggerChanged",
          "conditionChanged",
          "addedSteps",
          "removedSteps",
          "changedSteps"
        ],
        "properties": {
          "fromVersion": {
            "type": "integer",
            "example": 1
          },
          "toVersion": {
            "type": "integer",
            "example": 2
          },
          "triggerChanged": {
            "type": "boolean",
            "example": false
          },
          "fromTriggers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "toTriggers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "conditionChanged": {
            "type": "boolean",
            "example": true
          },
          "fromConditions": {
            "type": "object",
            "nullable": true
          },
          "toConditions": {
            "type": "object",
            "nullable": true
          },
          "configurationChanged": {
            "type": "boolean",
            "example": false
          },
          "addedSteps": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "removedSteps": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "changedSteps": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "RollbackWorkflowRequest": {
        "type": "object",
        "required": [
          "version"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "description": "Historical published version to rollback to. A new version N+1 is created with this snapshot.",
            "example": 1
          }
        }
      },
      "WorkflowDelay": {
        "type": "object",
        "required": [
          "id",
          "workflowExecutionId",
          "workflowId",
          "stepPosition",
          "status",
          "scheduledAt",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "del_abc123"
          },
          "workflowExecutionId": {
            "type": "string",
            "example": "wfe_456"
          },
          "workflowId": {
            "type": "string",
            "example": "wf_789"
          },
          "workflowVersionId": {
            "type": "string",
            "nullable": true
          },
          "workflowStepId": {
            "type": "string",
            "nullable": true
          },
          "stepPosition": {
            "type": "integer",
            "example": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "resumed",
              "cancelled",
              "failed"
            ],
            "example": "pending"
          },
          "scheduledAt": {
            "type": "string",
            "format": "date-time"
          },
          "startedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "resumedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "cancelledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "attempt": {
            "type": "integer",
            "example": 0
          },
          "lastError": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PublishWorkflowRequest": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "description": "Optional release notes or changelog message for this published version",
            "example": "Added HubSpot lead creation step"
          }
        }
      },
      "WorkflowHealthSummary": {
        "type": "object",
        "properties": {
          "window": {
            "type": "string",
            "example": "24h"
          },
          "totals": {
            "type": "object",
            "properties": {
              "totalWorkflows": {
                "type": "integer",
                "example": 24
              },
              "totalExecutions": {
                "type": "integer",
                "example": 12482
              },
              "completed": {
                "type": "integer",
                "example": 12320
              },
              "partiallyCompleted": {
                "type": "integer",
                "example": 40
              },
              "failed": {
                "type": "integer",
                "example": 122
              },
              "retrying": {
                "type": "integer",
                "example": 0
              },
              "overallSuccessRate": {
                "type": "number",
                "example": 98.7
              },
              "p95DurationMs": {
                "type": "integer",
                "example": 184
              },
              "totalRetries": {
                "type": "integer",
                "example": 213
              }
            }
          },
          "healthDistribution": {
            "type": "object",
            "properties": {
              "healthy": {
                "type": "integer",
                "example": 17
              },
              "degraded": {
                "type": "integer",
                "example": 2
              },
              "failing": {
                "type": "integer",
                "example": 1
              },
              "inactive": {
                "type": "integer",
                "example": 4
              }
            }
          },
          "failureCategories": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          },
          "workflows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "health": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "healthy",
                        "degraded",
                        "failing",
                        "inactive"
                      ]
                    },
                    "reasons": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                },
                "metrics": {
                  "type": "object",
                  "properties": {
                    "totalExecutions": {
                      "type": "integer"
                    },
                    "successRate": {
                      "type": "number"
                    },
                    "p95DurationMs": {
                      "type": "integer"
                    },
                    "failed": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "WorkflowObservabilityOverview": {
        "type": "object",
        "properties": {
          "workflowId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "health": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "healthy",
                  "degraded",
                  "failing",
                  "inactive"
                ]
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "metrics": {
            "type": "object",
            "properties": {
              "totalExecutions": {
                "type": "integer"
              },
              "completed": {
                "type": "integer"
              },
              "partiallyCompleted": {
                "type": "integer"
              },
              "failed": {
                "type": "integer"
              },
              "successRate": {
                "type": "number"
              },
              "avgDurationMs": {
                "type": "integer"
              },
              "p50DurationMs": {
                "type": "integer"
              },
              "p95DurationMs": {
                "type": "integer"
              },
              "p99DurationMs": {
                "type": "integer"
              },
              "totalRetries": {
                "type": "integer"
              }
            }
          },
          "failureBreakdown": {
            "type": "object",
            "properties": {
              "byCategory": {
                "type": "object",
                "additionalProperties": {
                  "type": "integer"
                }
              },
              "byProvider": {
                "type": "object",
                "additionalProperties": {
                  "type": "integer"
                }
              }
            }
          },
          "topFailures": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "fingerprint": {
                  "type": "string"
                },
                "category": {
                  "type": "string"
                },
                "provider": {
                  "type": "string"
                },
                "count": {
                  "type": "integer"
                },
                "sampleMessage": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "WorkflowFailure": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "fingerprint": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "actionType": {
            "type": "string"
          },
          "stepId": {
            "type": "string"
          },
          "stepPosition": {
            "type": "integer"
          },
          "status": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "durationMs": {
            "type": "integer"
          },
          "attempt": {
            "type": "integer"
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          },
          "workflowVersion": {
            "type": "integer"
          }
        }
      },
      "FailureTimeseriesBucket": {
        "type": "object",
        "properties": {
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "count": {
            "type": "integer"
          },
          "categories": {
            "type": "object",
            "additionalProperties": {
              "type": "integer"
            }
          }
        }
      },
      "ProviderObservability": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string"
          },
          "health": {
            "type": "string",
            "enum": [
              "healthy",
              "degraded",
              "failing",
              "inactive"
            ]
          },
          "circuitBreaker": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "CLOSED",
                  "OPEN",
                  "HALF_OPEN"
                ]
              },
              "failures": {
                "type": "integer"
              },
              "cooldownRemainingMs": {
                "type": "integer"
              }
            }
          },
          "metrics": {
            "type": "object",
            "properties": {
              "totalDeliveries": {
                "type": "integer"
              },
              "delivered": {
                "type": "integer"
              },
              "failed": {
                "type": "integer"
              },
              "successRate": {
                "type": "number"
              },
              "avgDurationMs": {
                "type": "integer"
              },
              "p95DurationMs": {
                "type": "integer"
              },
              "totalRetries": {
                "type": "integer"
              }
            }
          }
        }
      },
      "WorkflowVersionObservability": {
        "type": "object",
        "properties": {
          "version": {
            "type": "integer"
          },
          "isLive": {
            "type": "boolean"
          },
          "isDraft": {
            "type": "boolean"
          },
          "description": {
            "type": "string"
          },
          "metrics": {
            "type": "object",
            "properties": {
              "totalExecutions": {
                "type": "integer"
              },
              "completed": {
                "type": "integer"
              },
              "failed": {
                "type": "integer"
              },
              "successRate": {
                "type": "number"
              },
              "p95DurationMs": {
                "type": "integer"
              }
            }
          }
        }
      },
      "WorkflowRunObservability": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "workflowId": {
            "type": "string"
          },
          "workflowVersion": {
            "type": "integer"
          },
          "eventType": {
            "type": "string"
          },
          "eventId": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "durationMs": {
            "type": "integer"
          },
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedAt": {
            "type": "string",
            "format": "date-time"
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "stepId": {
                  "type": "string"
                },
                "position": {
                  "type": "integer"
                },
                "provider": {
                  "type": "string"
                },
                "action": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "attempt": {
                  "type": "integer"
                },
                "duration": {
                  "type": "integer"
                },
                "failureCategory": {
                  "type": "string"
                },
                "statusCode": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "IntegrationHealthSummary": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "summary": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              },
              "healthy": {
                "type": "integer"
              },
              "attention": {
                "type": "integer"
              },
              "critical": {
                "type": "integer"
              },
              "totalIssues": {
                "type": "integer"
              }
            }
          },
          "providers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "provider": {
                  "type": "string"
                },
                "providerName": {
                  "type": "string"
                },
                "health": {
                  "type": "string"
                },
                "issues": {
                  "type": "integer"
                },
                "totalIntegrations": {
                  "type": "integer"
                }
              }
            }
          },
          "integrations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationHealthDetail"
            }
          }
        }
      },
      "IntegrationHealthDetail": {
        "type": "object",
        "properties": {
          "integrationId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "providerName": {
            "type": "string"
          },
          "health": {
            "type": "string",
            "enum": [
              "healthy",
              "attention",
              "critical",
              "authentication_required",
              "resource_invalid",
              "rate_limited",
              "disabled",
              "unknown"
            ]
          },
          "reason": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "consecutiveFailures": {
            "type": "integer"
          },
          "lastDeliveryAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastErrorAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastErrorMessage": {
            "type": "string",
            "nullable": true
          },
          "circuitBreaker": {
            "type": "object",
            "properties": {
              "isOpen": {
                "type": "boolean"
              },
              "pausedUntil": {
                "type": "string",
                "nullable": true
              },
              "pauseReason": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "affectedWorkflows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "liveVersion": {
                  "type": "string"
                },
                "detailUrl": {
                  "type": "string"
                }
              }
            }
          },
          "affectedActions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "actionType": {
                  "type": "string"
                },
                "usedByWorkflowsCount": {
                  "type": "integer"
                }
              }
            }
          },
          "recommendedActions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "actionSafety": {
            "type": "string",
            "enum": [
              "safe",
              "requires_user",
              "forbidden"
            ]
          }
        }
      },
      "RemediationAction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "safety": {
            "type": "string",
            "enum": [
              "safe",
              "requires_user",
              "forbidden"
            ]
          },
          "recommended": {
            "type": "boolean"
          }
        }
      },
      "HealthTestResult": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "healthy"
          },
          "provider": {
            "type": "string"
          },
          "testedAt": {
            "type": "string",
            "format": "date-time"
          },
          "latencyMs": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "WorkflowGovernancePolicy": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "workspaceId": {
            "type": "string"
          },
          "workflowId": {
            "type": "string",
            "nullable": true
          },
          "enabled": {
            "type": "boolean"
          },
          "scope": {
            "type": "string",
            "enum": [
              "WORKSPACE",
              "WORKFLOW"
            ]
          },
          "requireApprovalForPublish": {
            "type": "boolean"
          },
          "requireApprovalForProductionChange": {
            "type": "boolean"
          },
          "requireApprovalForExecutionControlChange": {
            "type": "boolean"
          },
          "allowSelfApproval": {
            "type": "boolean"
          },
          "protectedWorkflow": {
            "type": "boolean"
          },
          "productionWorkflow": {
            "type": "boolean"
          },
          "ownerRequired": {
            "type": "boolean"
          },
          "allowManualExecution": {
            "type": "boolean"
          },
          "allowApiExecution": {
            "type": "boolean"
          },
          "allowWebhookExecution": {
            "type": "boolean"
          },
          "allowedIntegrationManagementRoles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allowedPublishRoles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allowedExecutionRoles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allowedEditRoles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "WorkflowGovernanceApproval": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "workspaceId": {
            "type": "string"
          },
          "workflowId": {
            "type": "string"
          },
          "workflowVersionId": {
            "type": "string",
            "nullable": true
          },
          "action": {
            "type": "string",
            "enum": [
              "PUBLISH_VERSION",
              "PRODUCTION_CHANGE",
              "EXECUTION_CONTROL_CHANGE",
              "GOVERNANCE_CHANGE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "APPROVED",
              "REJECTED",
              "CANCELLED",
              "EXPIRED"
            ]
          },
          "requestedBy": {
            "type": "string"
          },
          "approvedBy": {
            "type": "string",
            "nullable": true
          },
          "rejectedBy": {
            "type": "string",
            "nullable": true
          },
          "reason": {
            "type": "string",
            "nullable": true
          },
          "rejectionReason": {
            "type": "string",
            "nullable": true
          },
          "requestedAt": {
            "type": "string",
            "format": "date-time"
          },
          "approvedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "rejectedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "WorkflowPermission": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "workspaceId": {
            "type": "string"
          },
          "workflowId": {
            "type": "string"
          },
          "userId": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "WORKFLOW_VIEWER",
              "WORKFLOW_EDITOR",
              "WORKFLOW_OPERATOR",
              "WORKFLOW_PUBLISHER",
              "WORKFLOW_OWNER"
            ]
          },
          "grantedBy": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    "responses": {
      "BadRequestError": {
        "description": "Invalid input parameters",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "UnauthorizedError": {
        "description": "Authentication required or invalid token",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "NotFoundError": {
        "description": "The requested resource was not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "DeveloperBadRequestError": {
        "description": "Bad Request / Validation Failure",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DeveloperApiError"
            }
          }
        }
      },
      "DeveloperUnauthorizedError": {
        "description": "Invalid or missing API key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DeveloperApiError"
            }
          }
        }
      },
      "DeveloperForbiddenError": {
        "description": "Insufficient API key scope",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DeveloperApiError"
            }
          }
        }
      },
      "DeveloperNotFoundError": {
        "description": "Resource not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DeveloperApiError"
            }
          }
        }
      },
      "DeveloperConflictError": {
        "description": "Resource conflict or Idempotency Key payload mismatch",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DeveloperApiError"
            }
          }
        }
      },
      "DeveloperRateLimitError": {
        "description": "API rate limit exceeded",
        "headers": {
          "Retry-After": {
            "description": "Seconds to wait before retrying",
            "schema": {
              "type": "integer",
              "example": 30
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DeveloperApiError"
            }
          }
        }
      },
      "DeveloperInternalError": {
        "description": "Internal server error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DeveloperApiError"
            }
          }
        }
      },
      "OAuthError": {
        "description": "OAuth lifecycle or provider error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/OAuthError"
            }
          }
        }
      }
    },
    "parameters": {
      "IdempotencyKeyHeader": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Optional unique string to ensure mutation idempotency. Replaying with identical key returns cached response; different body returns 409 Conflict.",
        "schema": {
          "type": "string",
          "example": "req_link_create_123"
        }
      },
      "XRequestIdHeader": {
        "name": "X-Request-Id",
        "in": "header",
        "required": false,
        "description": "Optional client-supplied request ID for end-to-end tracing.",
        "schema": {
          "type": "string",
          "example": "req_01k12abc89def"
        }
      }
    }
  }
}
