{
  "openapi": "3.1.0",
  "info": {
    "title": "PixelEnhance Public API",
    "version": "1.0.0",
    "description": "Customer-facing /v1 contract. All requests use live keys. Local server shown; no hosted API origin is assumed. Dashboard management and internal callbacks are intentionally excluded."
  },
  "servers": [
    {
      "url": "http://127.0.0.1:4100",
      "description": "Local API"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "PixelEnhance API key. Endpoint descriptions specify required scopes."
      }
    }
  },
  "paths": {
    "/v1/uploads": {
      "post": {
        "operationId": "prepareUploads",
        "summary": "Prepare signed PUT uploads",
        "description": "Required scope: jobs:write. Create one upload per image using the exact byte size. The response contains one signed URL and a required header map per asset. PUT the raw file bytes to that URL using every returned header. Do not forward your API Bearer key to storage. Signed URLs last 15 minutes; the asset submission window lasts six hours. Maximum 30 files per request and 50 MiB per file. Outstanding retained inputs are limited to 300 files or 1 GiB per account. JPG/JPEG and supported RAW only.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "files": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "reference": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "filename": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "inputType": {
                          "type": "string",
                          "enum": [
                            "RAW",
                            "JPG"
                          ]
                        },
                        "sizeBytes": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 52428800
                        }
                      },
                      "required": [
                        "reference",
                        "filename",
                        "inputType",
                        "sizeBytes"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 30
                  }
                },
                "required": [
                  "files"
                ],
                "additionalProperties": false
              },
              "example": {
                "files": [
                  {
                    "reference": "room-1",
                    "filename": "exposure.jpg",
                    "inputType": "JPG",
                    "sizeBytes": 1048576
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "headers": {
              "x-request-id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "reference": {
                            "type": "string"
                          },
                          "method": {
                            "type": "string",
                            "const": "PUT"
                          },
                          "url": {
                            "type": "string"
                          },
                          "headers": {
                            "type": "object",
                            "properties": {
                              "Content-Type": {
                                "type": "string"
                              },
                              "If-None-Match": {
                                "type": "string",
                                "const": "*"
                              }
                            },
                            "required": [
                              "Content-Type",
                              "If-None-Match"
                            ]
                          },
                          "expiresAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "reference",
                          "method",
                          "url",
                          "headers",
                          "expiresAt"
                        ]
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                },
                "example": {
                  "data": [
                    {
                      "id": "UPLOAD_ID_1",
                      "reference": "room-1",
                      "method": "PUT",
                      "url": "https://upload.example.com/SIGNED_UPLOAD_PLACEHOLDER",
                      "headers": {
                        "Content-Type": "image/jpeg",
                        "If-None-Match": "*"
                      },
                      "expiresAt": "2026-11-14T10:15:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error; see error.code. 429 RATE_LIMITED includes Retry-After in seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error",
                    "requestId"
                  ]
                },
                "example": {
                  "error": {
                    "code": "UNAUTHORIZED",
                    "message": "Valid credentials required."
                  },
                  "requestId": "REQUEST_ID"
                }
              }
            }
          }
        }
      }
    },
    "/v1/uploads/{id}/complete": {
      "post": {
        "operationId": "completeUpload",
        "summary": "Verify and freeze an uploaded asset",
        "description": "Required scope: jobs:write. Send an empty POST: no JSON body and no Content-Type header are required. The API verifies the stored file size and records its identity. Repeating completion for an already verified, unexpired asset is safe. Use the same API key that prepared the upload. Only verified, unexpired, unclaimed assets can be submitted.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "x-request-id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "const": "verified"
                        }
                      },
                      "required": [
                        "id",
                        "status"
                      ]
                    }
                  },
                  "required": [
                    "data"
                  ]
                },
                "example": {
                  "data": {
                    "id": "UPLOAD_ID_1",
                    "status": "verified"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error; see error.code. 429 RATE_LIMITED includes Retry-After in seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error",
                    "requestId"
                  ]
                },
                "example": {
                  "error": {
                    "code": "UNAUTHORIZED",
                    "message": "Valid credentials required."
                  },
                  "requestId": "REQUEST_ID"
                }
              }
            }
          }
        }
      }
    },
    "/v1/enhancements": {
      "post": {
        "operationId": "createEnhancement",
        "summary": "Reserve credits and submit already-bracketed groups",
        "description": "Required scope: jobs:write. Each group is one bracket and produces one job. Supply 1–9 image IDs per group and at most 20 groups. No input ID may appear twice in a submission. The whole submission reserves 0.5 credit per bracket atomically. If credits are insufficient, none of its brackets are accepted. Idempotency-Key is required: 8–128 letters, digits, underscores or hyphens. Reuse it and the same request body after a timeout. A changed body with that key returns 409. The optional top-level reference is accepted but not returned as a tracking identifier. Use groups[].reference for job and webhook correlation.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reference": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "groups": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "reference": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "assetIds": {
                          "minItems": 1,
                          "maxItems": 9,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128
                          }
                        },
                        "classification": {
                          "type": "string",
                          "enum": [
                            "interior",
                            "exterior"
                          ]
                        },
                        "options": {
                          "type": "object",
                          "properties": {
                            "sky": {
                              "type": "string",
                              "enum": [
                                "Cumulus",
                                "Mostly Cloudy",
                                "Cirrocumulus",
                                "Wispy",
                                "Clear Sky",
                                "No Sky",
                                "Twilight"
                              ]
                            },
                            "enhancementStyle": {
                              "type": "string",
                              "enum": [
                                "signature",
                                "natural"
                              ]
                            },
                            "autoCorrectVerticals": {
                              "type": "boolean"
                            },
                            "outputSize": {
                              "type": "string",
                              "enum": [
                                "2k",
                                "4k"
                              ]
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "reference",
                        "assetIds",
                        "classification"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 20
                  }
                },
                "required": [
                  "groups"
                ],
                "additionalProperties": false
              },
              "example": {
                "groups": [
                  {
                    "reference": "living-room",
                    "assetIds": [
                      "UPLOAD_ID_1",
                      "UPLOAD_ID_2",
                      "UPLOAD_ID_3"
                    ],
                    "classification": "interior",
                    "options": {
                      "enhancementStyle": "signature",
                      "autoCorrectVerticals": true,
                      "outputSize": "2k"
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Successful response",
            "headers": {
              "x-request-id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "jobs": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "reference": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "status",
                              "reference"
                            ]
                          }
                        }
                      },
                      "required": [
                        "id",
                        "jobs"
                      ]
                    }
                  },
                  "required": [
                    "data"
                  ]
                },
                "example": {
                  "data": {
                    "id": "SUBMISSION_ID",
                    "jobs": [
                      {
                        "id": "JOB_ID",
                        "status": "queued",
                        "reference": "living-room"
                      }
                    ]
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error; see error.code. 429 RATE_LIMITED includes Retry-After in seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error",
                    "requestId"
                  ]
                },
                "example": {
                  "error": {
                    "code": "UNAUTHORIZED",
                    "message": "Valid credentials required."
                  },
                  "requestId": "REQUEST_ID"
                }
              }
            }
          }
        }
      }
    },
    "/v1/jobs": {
      "get": {
        "operationId": "listJobs",
        "summary": "List jobs belonging to the authenticated account",
        "description": "Required scope: jobs:read. Lists jobs belonging to the calling key. It cannot retrieve another key’s jobs, even on the same account. Supported filters: page (default 1), pageSize (default 10, maximum 100), status, from and to (UTC ISO timestamps). Results are newest submitted first. The response has data, total, page and pageSize. Do not infer account-wide totals from one page.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "processing",
                "succeeded",
                "failed"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "x-request-id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "keyId": {
                            "type": "string"
                          },
                          "mode": {
                            "type": "string",
                            "enum": [
                              "live",
                              "test"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "queued",
                              "processing",
                              "succeeded",
                              "failed"
                            ]
                          },
                          "submittedAt": {
                            "type": "string"
                          },
                          "startedAt": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "completedAt": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "reference": {
                            "type": "string"
                          },
                          "classification": {
                            "type": "string",
                            "enum": [
                              "interior",
                              "exterior"
                            ]
                          },
                          "options": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          "outputId": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "expiresAt": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "creditsCharged": {
                            "type": "number",
                            "minimum": 0
                          },
                          "errorCode": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "keyId",
                          "mode",
                          "status",
                          "submittedAt",
                          "startedAt",
                          "completedAt",
                          "reference",
                          "classification",
                          "options",
                          "outputId",
                          "expiresAt",
                          "creditsCharged",
                          "errorCode"
                        ]
                      }
                    },
                    "total": {
                      "type": "number"
                    },
                    "page": {
                      "type": "number"
                    },
                    "pageSize": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "data",
                    "total",
                    "page",
                    "pageSize"
                  ]
                },
                "example": {
                  "data": [
                    {
                      "id": "JOB_ID",
                      "keyId": "KEY_ID",
                      "mode": "live",
                      "status": "succeeded",
                      "submittedAt": "2026-11-14T10:00:00.000Z",
                      "startedAt": "2026-11-14T10:00:05.000Z",
                      "completedAt": "2026-11-14T10:03:00.000Z",
                      "reference": "living-room",
                      "classification": "interior",
                      "options": {
                        "outputSize": "2k"
                      },
                      "outputId": "JOB_ID",
                      "expiresAt": "2026-11-21T10:03:00.000Z",
                      "creditsCharged": 0.5,
                      "errorCode": null
                    }
                  ],
                  "total": 1,
                  "page": 1,
                  "pageSize": 10
                }
              }
            }
          },
          "default": {
            "description": "Error; see error.code. 429 RATE_LIMITED includes Retry-After in seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error",
                    "requestId"
                  ]
                },
                "example": {
                  "error": {
                    "code": "UNAUTHORIZED",
                    "message": "Valid credentials required."
                  },
                  "requestId": "REQUEST_ID"
                }
              }
            }
          }
        }
      }
    },
    "/v1/jobs/{id}": {
      "get": {
        "operationId": "getJob",
        "summary": "Read job status and timing",
        "description": "Required scope: jobs:read. States are queued, processing, succeeded and failed. Poll every few seconds and back off on 429, or receive a webhook. outputId is non-null only on success. A failed job returns a sanitized errorCode and releases its reserved credits. A job’s options show the selected settings. An omitted outputSize means 2K.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "x-request-id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "keyId": {
                          "type": "string"
                        },
                        "mode": {
                          "type": "string",
                          "enum": [
                            "live",
                            "test"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "queued",
                            "processing",
                            "succeeded",
                            "failed"
                          ]
                        },
                        "submittedAt": {
                          "type": "string"
                        },
                        "startedAt": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "completedAt": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "reference": {
                          "type": "string"
                        },
                        "classification": {
                          "type": "string",
                          "enum": [
                            "interior",
                            "exterior"
                          ]
                        },
                        "options": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "outputId": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "expiresAt": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "creditsCharged": {
                          "type": "number",
                          "minimum": 0
                        },
                        "errorCode": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "keyId",
                        "mode",
                        "status",
                        "submittedAt",
                        "startedAt",
                        "completedAt",
                        "reference",
                        "classification",
                        "options",
                        "outputId",
                        "expiresAt",
                        "creditsCharged",
                        "errorCode"
                      ]
                    }
                  },
                  "required": [
                    "data"
                  ]
                },
                "example": {
                  "data": {
                    "id": "JOB_ID",
                    "keyId": "KEY_ID",
                    "mode": "live",
                    "status": "succeeded",
                    "submittedAt": "2026-11-14T10:00:00.000Z",
                    "startedAt": "2026-11-14T10:00:05.000Z",
                    "completedAt": "2026-11-14T10:03:00.000Z",
                    "reference": "living-room",
                    "classification": "interior",
                    "options": {
                      "outputSize": "2k"
                    },
                    "outputId": "JOB_ID",
                    "expiresAt": "2026-11-21T10:03:00.000Z",
                    "creditsCharged": 0.5,
                    "errorCode": null
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error; see error.code. 429 RATE_LIMITED includes Retry-After in seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error",
                    "requestId"
                  ]
                },
                "example": {
                  "error": {
                    "code": "UNAUTHORIZED",
                    "message": "Valid credentials required."
                  },
                  "requestId": "REQUEST_ID"
                }
              }
            }
          }
        }
      }
    },
    "/v1/outputs/{id}": {
      "get": {
        "operationId": "getOutput",
        "summary": "Read an unexpired output",
        "description": "Required scope: outputs:read. The output ID is the job ID. Use the same issuing key and outputs:read scope. Returns a JPG download URL valid for up to five minutes and never beyond the output’s seven-day retention deadline. Request a fresh URL when a link expires. Download from data.downloadUrl without your API Bearer key. Missing, expired, unavailable or other-key output returns 404.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "x-request-id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "jobId": {
                          "type": "string"
                        },
                        "keyId": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "downloadUrl": {
                          "type": "string",
                          "format": "uri"
                        },
                        "urlExpiresAt": {
                          "type": "string"
                        },
                        "completedAt": {
                          "type": "string"
                        },
                        "expiresAt": {
                          "type": "string"
                        },
                        "format": {
                          "type": "string"
                        },
                        "outputSize": {
                          "default": "2k",
                          "type": "string",
                          "enum": [
                            "2k",
                            "4k"
                          ]
                        },
                        "sizeBytes": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "id",
                        "jobId",
                        "keyId",
                        "name",
                        "downloadUrl",
                        "urlExpiresAt",
                        "completedAt",
                        "expiresAt",
                        "format",
                        "sizeBytes"
                      ]
                    }
                  },
                  "required": [
                    "data"
                  ]
                },
                "example": {
                  "data": {
                    "id": "JOB_ID",
                    "jobId": "JOB_ID",
                    "keyId": "KEY_ID",
                    "name": "living-room",
                    "downloadUrl": "https://download.example.com/SIGNED_DOWNLOAD_PLACEHOLDER",
                    "urlExpiresAt": "2026-11-14T10:08:00.000Z",
                    "completedAt": "2026-11-14T10:03:00.000Z",
                    "expiresAt": "2026-11-21T10:03:00.000Z",
                    "format": "jpg",
                    "outputSize": "2k",
                    "sizeBytes": 2048000
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error; see error.code. 429 RATE_LIMITED includes Retry-After in seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    },
                    "requestId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error",
                    "requestId"
                  ]
                },
                "example": {
                  "error": {
                    "code": "UNAUTHORIZED",
                    "message": "Valid credentials required."
                  },
                  "requestId": "REQUEST_ID"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "jobNotification": {
      "post": {
        "summary": "Signed job result or connection test sent to your registered receiver",
        "description": "Verify HMAC-SHA256 of timestamp + period + raw body using your endpoint secret. Reject timestamps outside five minutes; deduplicate event IDs. Return 2xx within ten seconds after durable recording. Eight automatic delivery attempts; no ordering guarantee.",
        "parameters": [
          {
            "name": "PixelEnhance-Event-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "PixelEnhance-Timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "PixelEnhance-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "job.succeeded",
                          "job.failed"
                        ]
                      },
                      "createdAt": {
                        "type": "string"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "jobId": {
                            "type": "string"
                          },
                          "reference": {
                            "type": "string"
                          },
                          "outputId": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "outputSize": {
                            "type": "string",
                            "enum": [
                              "2k",
                              "4k"
                            ]
                          },
                          "creditsCharged": {
                            "type": "number",
                            "minimum": 0
                          },
                          "errorCode": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "jobId",
                          "reference",
                          "outputId",
                          "outputSize",
                          "creditsCharged",
                          "errorCode"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "type",
                      "createdAt",
                      "data"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string",
                        "const": "webhook.test"
                      },
                      "createdAt": {
                        "type": "string"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "message"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "type",
                      "createdAt",
                      "data"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Event durably recorded or already handled (any 2xx is accepted)."
          },
          "204": {
            "description": "Acknowledged with no response body."
          },
          "default": {
            "description": "Delivery will be retried; redirects are not followed."
          }
        }
      }
    }
  }
}
