{
  "openapi": "3.1.1",
  "info": {
    "title": "Maskyard",
    "description": "Background removal for product images, asynchronous: upload or name an image, get a job id, read its state or receive a webhook, then download the transparent cutout and its 8-bit alpha mask. Every error is `application/problem+json` with a stable `code`.",
    "version": "v1"
  },
  "paths": {
    "/v1/account": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Read the account",
        "description": "The account's status and, once its owner deleted it, the deletion's progress.",
        "operationId": "getAccount",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/assets/{id}": {
      "get": {
        "tags": [
          "Assets"
        ],
        "summary": "Read an asset",
        "description": "One stored file by the asset id a job's results carry: its type, size, dimensions and expiry, and a download URL signed for this read (15 minutes). Past its retention it answers file_expired.",
        "operationId": "getAsset",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssetResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "410": {
            "description": "Gone: file_expired.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "file_expired"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/batches": {
      "post": {
        "tags": [
          "Batches"
        ],
        "summary": "Submit a batch",
        "description": "Creates one job per valid item and reserves one credit each. Every item is checked on its own; an invalid one is rejected by index with a code and the rest go ahead (202). With validateOnly=true nothing is written: the answer (200) lists the rejections and the credits the valid items need against those available. Short of credits for the valid items, nothing is created (402).",
        "operationId": "submitBatch",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Your key for this submission, scoped to the account: a replay with the same key and body returns the original result without charging again. 1 to 255 visible ASCII characters, no spaces. Required unless validateOnly=true, which ignores it.",
            "schema": {
              "maxLength": 255,
              "minLength": 1,
              "pattern": "^[!-~]+$",
              "type": "string"
            },
            "x-required-unless": "validateOnly=true"
          },
          {
            "name": "validateOnly",
            "in": "query",
            "description": "Check the items and the credits without creating anything.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmitBatchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchValidationResponse"
                }
              }
            }
          },
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AcceptedBatchResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request: batch_too_large, unknown_subject, invalid_request, idempotency_key_required.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "batch_too_large",
                            "unknown_subject",
                            "invalid_request",
                            "idempotency_key_required"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "402": {
            "description": "Payment Required: insufficient_credits.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "insufficient_credits"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_restricted, account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_restricted",
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Conflict: idempotency_key_reused.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "idempotency_key_reused"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "415": {
            "description": "Unsupported Media Type: unsupported_media_type.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unsupported_media_type"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      },
      "get": {
        "tags": [
          "Batches"
        ],
        "summary": "List batches",
        "description": "The account's batches, newest first, with their counts.",
        "operationId": "listBatches",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "description": "The nextCursor of the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Batches per page.",
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request: invalid_request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "invalid_request"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/batches/{id}": {
      "get": {
        "tags": [
          "Batches"
        ],
        "summary": "Read a batch",
        "description": "The batch's status and counts, derived from its items, and a page of items in submission order (rejected ones in place), each with its results and download URLs signed for this read.",
        "operationId": "getBatch",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "The nextCursor of the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Items per page.",
            "schema": {
              "maximum": 200,
              "minimum": 1,
              "type": "integer",
              "format": "int32",
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request: invalid_request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "invalid_request"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      },
      "delete": {
        "tags": [
          "Batches"
        ],
        "summary": "Delete a batch",
        "description": "Deletes the batch's items, their inputs and outputs and the export files that contain them, and stops what hasn't finished. The batch reads as not found from this request on. 202 while deleting, 200 once done; asking again is safe.",
        "operationId": "deleteBatch",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletionResponse"
                }
              }
            }
          },
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletionResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/batches/{id}/cancel": {
      "post": {
        "tags": [
          "Batches"
        ],
        "summary": "Cancel a batch",
        "description": "Stops admission and cancels every unfinished item: items not yet on the GPU stop and release their credits; running ones are asked to stop (202), and a result stored before that takes effect is charged.",
        "operationId": "cancelBatch",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelBatchResponse"
                }
              }
            }
          },
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelBatchResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/batches/{id}/retry": {
      "post": {
        "tags": [
          "Batches"
        ],
        "summary": "Retry failed items",
        "description": "Retries the items that failed for a technical reason (processing_failed, fetch_failed, job_timed_out) as new jobs, one credit each; input refusals would fail again and are left alone. 202 when items were retried, 200 when none could be. Short of credits for all of them, nothing is retried (402). The batch sends batch.completed again once the retried items have finished.",
        "operationId": "retryBatch",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Your key for this submission, scoped to the account: a replay with the same key and body returns the original result without charging again. 1 to 255 visible ASCII characters, no spaces.",
            "required": true,
            "schema": {
              "maxLength": 255,
              "minLength": 1,
              "pattern": "^[!-~]+$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RetryBatchResponse"
                }
              }
            }
          },
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RetryBatchResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request: invalid_request, idempotency_key_required.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "invalid_request",
                            "idempotency_key_required"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "402": {
            "description": "Payment Required: insufficient_credits.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "insufficient_credits"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/billing": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Read billing",
        "description": "The subscription, recent purchases and, when new processing is paused, why.",
        "operationId": "getBilling",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/exports": {
      "post": {
        "tags": [
          "Exports"
        ],
        "summary": "Create an export",
        "description": "Makes files from stored outputs on the CPU, with no new inference and no credits: a formatted variant of one succeeded job (jobId with spec), or a batch's files as ZIP parts of about 1 GiB with a CSV manifest (batchId). Asynchronous: read the export until it succeeds. An identical variant made recently is reused. Export creation has its own hourly limit per account.",
        "operationId": "createExport",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Your key for this submission, scoped to the account: a replay with the same key and body returns the original result without charging again. 1 to 255 visible ASCII characters, no spaces.",
            "required": true,
            "schema": {
              "maxLength": 255,
              "minLength": 1,
              "pattern": "^[!-~]+$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateExportRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AcceptedExportResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request: invalid_request, idempotency_key_required.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "invalid_request",
                            "idempotency_key_required"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Conflict: idempotency_key_reused, job_not_succeeded.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "idempotency_key_reused",
                            "job_not_succeeded"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "410": {
            "description": "Gone: file_expired.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "file_expired"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "415": {
            "description": "Unsupported Media Type: unsupported_media_type.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unsupported_media_type"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      },
      "get": {
        "tags": [
          "Exports"
        ],
        "summary": "List exports",
        "description": "The account's exports, newest first, without download URLs (read an export for those).",
        "operationId": "listExports",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "description": "The nextCursor of the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Exports per page.",
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExportListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request: invalid_request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "invalid_request"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/exports/{id}": {
      "get": {
        "tags": [
          "Exports"
        ],
        "summary": "Read an export",
        "description": "The export's state and, once it succeeded, its files with download URLs signed for this read (15 minutes). Files are deleted 24 hours after the export completed.",
        "operationId": "getExport",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExportResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/images": {
      "post": {
        "tags": [
          "Jobs"
        ],
        "summary": "Submit an image",
        "description": "Creates a job for one image, from an upload (POST /v1/uploads) or a public https URL, and reserves one credit for it. Answers 202 with the job's id at once; processing is asynchronous: read the job, or receive a webhook when it ends. A replay with the same Idempotency-Key and body returns the same job.",
        "operationId": "submitImage",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Your key for this submission, scoped to the account: a replay with the same key and body returns the original result without charging again. 1 to 255 visible ASCII characters, no spaces.",
            "required": true,
            "schema": {
              "maxLength": 255,
              "minLength": 1,
              "pattern": "^[!-~]+$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmitImageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AcceptedJobResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request: unsafe_url, unknown_subject, invalid_request, idempotency_key_required.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unsafe_url",
                            "unknown_subject",
                            "invalid_request",
                            "idempotency_key_required"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "402": {
            "description": "Payment Required: insufficient_credits.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "insufficient_credits"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_restricted, account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_restricted",
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Conflict: idempotency_key_reused.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "idempotency_key_reused"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "410": {
            "description": "Gone: file_expired.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "file_expired"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "415": {
            "description": "Unsupported Media Type: unsupported_media_type.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unsupported_media_type"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/jobs": {
      "get": {
        "tags": [
          "Jobs"
        ],
        "summary": "List jobs",
        "description": "The account's jobs, newest first, without download URLs (read a job for those). A batch's retried items appear once, as their newest job.",
        "operationId": "listJobs",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "description": "The nextCursor of the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Jobs per page.",
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer",
              "format": "int32",
              "default": 25
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Only jobs in this state.",
            "schema": {
              "enum": [
                "awaiting_upload",
                "validating",
                "queued",
                "running",
                "succeeded",
                "failed",
                "cancelled"
              ],
              "type": "string"
            }
          },
          {
            "name": "batchId",
            "in": "query",
            "description": "Only the items of this batch.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request: invalid_request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "invalid_request"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/jobs/{id}": {
      "get": {
        "tags": [
          "Jobs"
        ],
        "summary": "Read a job",
        "description": "The job's state, error, subject, model version and results. Every read signs fresh download URLs for the input and the outputs, valid for 15 minutes; store the asset ids, never the URLs.",
        "operationId": "getJob",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      },
      "delete": {
        "tags": [
          "Jobs"
        ],
        "summary": "Delete a job",
        "description": "Deletes the job's input, outputs and the export files that contain them, and stops it if it hasn't finished. The job reads as not found from this request on. 202 while the files are being deleted, 200 once they are; asking again is safe. A batch item is deleted with its batch (job_in_batch).",
        "operationId": "deleteJob",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletionResponse"
                }
              }
            }
          },
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletionResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Conflict: job_in_batch.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "job_in_batch"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/jobs/{id}/cancel": {
      "post": {
        "tags": [
          "Jobs"
        ],
        "summary": "Cancel a job",
        "description": "A job not yet on the GPU is cancelled at once and its credit released (200). A running job is asked to stop (202, executionStarted true): a result stored before the cancellation takes effect is still charged; otherwise the credit is released.",
        "operationId": "cancelJob",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelJobResponse"
                }
              }
            }
          },
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelJobResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Conflict: job_not_cancellable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "job_not_cancellable"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/jobs/{id}/reports": {
      "post": {
        "tags": [
          "Reports"
        ],
        "summary": "Report a poor result",
        "description": "Reports a problem with a succeeded job's cutout. We review it and may restore the job's credit; a restored credit shows in the credit history. One open report per job.",
        "operationId": "reportJobIssue",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReportIssueRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueReportResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request: invalid_request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "invalid_request"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Conflict: job_not_succeeded, report_already_open.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "job_not_succeeded",
                            "report_already_open"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "415": {
            "description": "Unsupported Media Type: unsupported_media_type.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unsupported_media_type"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      },
      "get": {
        "tags": [
          "Reports"
        ],
        "summary": "List a job's reports",
        "description": "The job's issue reports, newest first.",
        "operationId": "listJobReports",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobIssueReportsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/limits": {
      "get": {
        "tags": [
          "Limits"
        ],
        "summary": "Read the limits",
        "description": "The account's limits at its tier, read from what enforces them, so a client can check a file or a batch before submitting it.",
        "operationId": "getLimits",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LimitsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/queue": {
      "get": {
        "tags": [
          "Jobs"
        ],
        "summary": "Read the queue",
        "description": "The account's unfinished jobs by state, its in-flight limit and its oldest queued job.",
        "operationId": "getQueue",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/reports": {
      "get": {
        "tags": [
          "Reports"
        ],
        "summary": "List reports",
        "description": "The account's issue reports, newest first.",
        "operationId": "listReports",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "description": "The nextCursor of the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Reports per page.",
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer",
              "format": "int32",
              "default": 25
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Only reports in this state.",
            "schema": {
              "enum": [
                "open",
                "resolved_restored",
                "resolved_declined"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueReportListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request: invalid_request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "invalid_request"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/uploads": {
      "post": {
        "tags": [
          "Uploads"
        ],
        "summary": "Create an upload",
        "description": "Allocates an input and signs one PUT to private storage, so the bytes go straight there and never through the API. Size, type and pixel count are checked when a job validates the upload, not here.",
        "operationId": "createUpload",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUploadRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request: invalid_request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "invalid_request"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "415": {
            "description": "Unsupported Media Type: unsupported_media_type.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unsupported_media_type"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/usage": {
      "get": {
        "tags": [
          "Credits"
        ],
        "summary": "Read credits",
        "description": "Available, reserved and consumed credits, and every grant in spending order: the earliest expiry is spent first.",
        "operationId": "getUsage",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/usage/history": {
      "get": {
        "tags": [
          "Credits"
        ],
        "summary": "List the credit history",
        "description": "The account's credit ledger entries of the last 90 days, newest first: grants, reservations, settlements, releases and adjustments.",
        "operationId": "listCreditHistory",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "description": "The nextCursor of the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Entries per page.",
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer",
              "format": "int32",
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditHistoryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request: invalid_request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "invalid_request"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/webhook-endpoints": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Register a webhook endpoint",
        "description": "Registers an https URL that receives the account's events, signed with a secret shown in this response only. The URL must be public: private, loopback, link-local and metadata addresses are refused, at registration and again on every delivery. Without events it receives every type.",
        "operationId": "createWebhookEndpoint",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookEndpointRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedWebhookEndpointResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request: unsafe_url, invalid_request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unsafe_url",
                            "invalid_request"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Conflict: webhook_endpoint_limit_reached.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "webhook_endpoint_limit_reached"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "415": {
            "description": "Unsupported Media Type: unsupported_media_type.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unsupported_media_type"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      },
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhook endpoints",
        "description": "The account's endpoints, each with its newest delivery.",
        "operationId": "listWebhookEndpoints",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/webhook-endpoints/{id}": {
      "patch": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Change a webhook endpoint",
        "description": "Changes the fields sent; the others stay. A new URL is checked again.",
        "operationId": "updateWebhookEndpoint",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWebhookEndpointRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request: unsafe_url, invalid_request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unsafe_url",
                            "invalid_request"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "415": {
            "description": "Unsupported Media Type: unsupported_media_type.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unsupported_media_type"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      },
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook endpoint",
        "description": "Deletes the endpoint and its delivery log; pending deliveries are not sent.",
        "operationId": "deleteWebhookEndpoint",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/webhook-endpoints/{id}/deliveries": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List an endpoint's deliveries",
        "description": "The endpoint's deliveries, newest first, each with its attempts and the event data as sent.",
        "operationId": "listWebhookDeliveries",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "The nextCursor of the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Deliveries per page.",
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliveryPageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request: invalid_request.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "invalid_request"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    },
    "/v1/webhook-endpoints/{id}/rotate-secret": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Rotate the signing secret",
        "description": "Issues a new signing secret, shown in this response only. For 24 hours deliveries carry a signature with each secret, so a receiver can switch without missing one.",
        "operationId": "rotateWebhookSecret",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotatedWebhookSecretResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: unauthenticated.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "unauthenticated"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: account_closed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "account_closed"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not Found: not_found.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "not_found"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests: rate_limited.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the limit's window lets the request through.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "rate_limited"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "An unexpected error: internal_error.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Problem"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "enum": [
                            "internal_error"
                          ],
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKey": [ ]
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "AcceptedBatchResponse": {
        "required": [
          "id",
          "items"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The batch's id."
          },
          "items": {
            "description": "What it admitted.",
            "$ref": "#/components/schemas/BatchAdmissionResponse"
          }
        },
        "description": "The accepted batch; the Location header names it too."
      },
      "AcceptedExportResponse": {
        "required": [
          "id",
          "state"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The export's id."
          },
          "state": {
            "description": "queued, or succeeded at once when an identical variant was reused.",
            "$ref": "#/components/schemas/ExportState"
          }
        },
        "description": "The accepted export; the Location header names it too."
      },
      "AcceptedJobResponse": {
        "required": [
          "id",
          "state"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The job's id."
          },
          "state": {
            "description": "awaiting_upload until an upload's bytes are stored, else validating.",
            "$ref": "#/components/schemas/JobState"
          }
        },
        "description": "The accepted job; the Location header names it too."
      },
      "AccountResponse": {
        "required": [
          "id",
          "status",
          "createdAt",
          "deletion"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The account's id."
          },
          "status": {
            "description": "active; restricted_for_review after a refund or dispute took back more than was left (no new processing until we review it); closed once deleted.",
            "$ref": "#/components/schemas/AccountStatus"
          },
          "createdAt": {
            "type": "string",
            "description": "When the account was created.",
            "format": "date-time"
          },
          "deletion": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "description": "The deletion's progress; null unless the account was deleted.",
                "$ref": "#/components/schemas/DeletionResponse"
              }
            ]
          }
        },
        "description": "The account."
      },
      "AccountStatus": {
        "enum": [
          "active",
          "restricted_for_review",
          "closed"
        ],
        "type": "string"
      },
      "AssetKind": {
        "enum": [
          "input",
          "cutout",
          "mask",
          "preview"
        ],
        "type": "string"
      },
      "AssetResponse": {
        "required": [
          "id",
          "type",
          "contentType",
          "bytes",
          "width",
          "height",
          "jobId",
          "createdAt",
          "expiresAt",
          "url",
          "urlExpiresAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The asset's id."
          },
          "type": {
            "description": "input (an original), cutout, mask or preview.",
            "$ref": "#/components/schemas/AssetKind"
          },
          "contentType": {
            "type": "string",
            "description": "The file's media type."
          },
          "bytes": {
            "type": [
              "null",
              "integer"
            ],
            "description": "The file's size; null until known.",
            "format": "int64"
          },
          "width": {
            "type": [
              "null",
              "integer"
            ],
            "description": "Pixels; an input's once validated.",
            "format": "int32"
          },
          "height": {
            "type": [
              "null",
              "integer"
            ],
            "description": "Pixels; an input's once validated.",
            "format": "int32"
          },
          "jobId": {
            "type": [
              "null",
              "string"
            ],
            "description": "The job an output belongs to."
          },
          "createdAt": {
            "type": "string",
            "description": "When the asset was created.",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "description": "When the file is deleted: originals after 7 days, outputs 30 days after the job completed.",
            "format": "date-time"
          },
          "url": {
            "type": [
              "null",
              "string"
            ],
            "description": "The file, signed for this read; null while an input's bytes aren't stored yet.",
            "format": "uri"
          },
          "urlExpiresAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When url stops working.",
            "format": "date-time"
          }
        },
        "description": "A stored file. Its URL is signed for this response only."
      },
      "BatchAdmissionResponse": {
        "required": [
          "admitted",
          "rejected"
        ],
        "type": "object",
        "properties": {
          "admitted": {
            "type": "integer",
            "description": "Items that became jobs, one credit reserved each.",
            "format": "int32"
          },
          "rejected": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BatchItemRejectionResponse"
            },
            "description": "Items that didn't, by index, with the reason."
          }
        },
        "description": "The items a submission admitted and rejected."
      },
      "BatchCountsResponse": {
        "required": [
          "total",
          "pending",
          "awaitingUpload",
          "validating",
          "queued",
          "running",
          "succeeded",
          "failed",
          "cancelled",
          "rejected"
        ],
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "description": "Every item.",
            "format": "int32"
          },
          "pending": {
            "type": "integer",
            "description": "Items not yet admitted.",
            "format": "int32"
          },
          "awaitingUpload": {
            "type": "integer",
            "description": "Waiting for an upload's bytes.",
            "format": "int32"
          },
          "validating": {
            "type": "integer",
            "description": "Being fetched or checked.",
            "format": "int32"
          },
          "queued": {
            "type": "integer",
            "description": "Waiting for a GPU slot.",
            "format": "int32"
          },
          "running": {
            "type": "integer",
            "description": "On the GPU.",
            "format": "int32"
          },
          "succeeded": {
            "type": "integer",
            "description": "With outputs.",
            "format": "int32"
          },
          "failed": {
            "type": "integer",
            "description": "Failed.",
            "format": "int32"
          },
          "cancelled": {
            "type": "integer",
            "description": "Cancelled.",
            "format": "int32"
          },
          "rejected": {
            "type": "integer",
            "description": "Rejected at submission.",
            "format": "int32"
          }
        },
        "description": "A batch's items by state."
      },
      "BatchCreditsResponse": {
        "required": [
          "required",
          "available",
          "shortfall"
        ],
        "type": "object",
        "properties": {
          "required": {
            "type": "integer",
            "description": "One per valid item.",
            "format": "int32"
          },
          "available": {
            "type": "integer",
            "description": "The account's available credits.",
            "format": "int32"
          },
          "shortfall": {
            "type": "integer",
            "description": "Credits missing; 0 when there are enough.",
            "format": "int32"
          }
        },
        "description": "Credits for a dry run's valid items."
      },
      "BatchEventData": {
        "required": [
          "batchId",
          "completion",
          "status",
          "counts"
        ],
        "type": "object",
        "properties": {
          "batchId": {
            "type": "string",
            "description": "The batch."
          },
          "completion": {
            "type": "integer",
            "description": "1 for the first ending, 2 after the first retry has finished, and so on: ignore a completion lower than one you have seen.",
            "format": "int32"
          },
          "status": {
            "enum": [
              "completed",
              "completed_with_failures",
              "cancelled"
            ],
            "type": "string",
            "description": "The batch's status when it ended."
          },
          "counts": {
            "required": [
              "total",
              "pending",
              "awaitingUpload",
              "validating",
              "queued",
              "running",
              "succeeded",
              "failed",
              "cancelled",
              "rejected"
            ],
            "type": "object",
            "properties": {
              "total": {
                "type": "integer",
                "format": "int32"
              },
              "pending": {
                "type": "integer",
                "format": "int32"
              },
              "awaitingUpload": {
                "type": "integer",
                "format": "int32"
              },
              "validating": {
                "type": "integer",
                "format": "int32"
              },
              "queued": {
                "type": "integer",
                "format": "int32"
              },
              "running": {
                "type": "integer",
                "format": "int32"
              },
              "succeeded": {
                "type": "integer",
                "format": "int32"
              },
              "failed": {
                "type": "integer",
                "format": "int32"
              },
              "cancelled": {
                "type": "integer",
                "format": "int32"
              },
              "rejected": {
                "type": "integer",
                "format": "int32"
              }
            },
            "description": "Its items by state when it ended, as GET /v1/batches/{id} counts them."
          }
        },
        "description": "`data` of batch.completed."
      },
      "BatchItemRejectionResponse": {
        "required": [
          "index",
          "code",
          "message",
          "sku",
          "filename"
        ],
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "description": "Its position in the submission, from 0.",
            "format": "int32"
          },
          "code": {
            "enum": [
              "invalid_item",
              "unsafe_url",
              "upload_not_found",
              "file_expired",
              "insufficient_credits",
              "account_restricted"
            ],
            "type": "string",
            "description": "Why; see the batch item codes."
          },
          "message": {
            "type": "string",
            "description": "For a person to read; may change."
          },
          "sku": {
            "type": [
              "null",
              "string"
            ],
            "description": "The SKU sent with it."
          },
          "filename": {
            "type": [
              "null",
              "string"
            ],
            "description": "The filename sent with it."
          }
        },
        "description": "An item that got no job."
      },
      "BatchItemResponse": {
        "required": [
          "index",
          "sku",
          "filename",
          "state",
          "jobId",
          "error",
          "results"
        ],
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "description": "Its position in the submission, from 0.",
            "format": "int32"
          },
          "sku": {
            "type": [
              "null",
              "string"
            ],
            "description": "The SKU sent with it."
          },
          "filename": {
            "type": [
              "null",
              "string"
            ],
            "description": "The filename sent with it."
          },
          "state": {
            "description": "The job's state, or rejected.",
            "$ref": "#/components/schemas/BatchItemState"
          },
          "jobId": {
            "type": [
              "null",
              "string"
            ],
            "description": "The item's current job (after a retry, the new one); null when rejected."
          },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "description": "Why it failed or was rejected.",
                "$ref": "#/components/schemas/JobErrorResponse"
              }
            ]
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobResultResponse"
            },
            "description": "A succeeded item's outputs."
          }
        },
        "description": "An item of a batch: its current job, or its rejection."
      },
      "BatchItemState": {
        "enum": [
          "awaiting_upload",
          "validating",
          "queued",
          "running",
          "succeeded",
          "failed",
          "cancelled",
          "rejected"
        ],
        "type": "string"
      },
      "BatchListResponse": {
        "required": [
          "items",
          "nextCursor"
        ],
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BatchSummaryResponse"
            },
            "description": "The batches on this page."
          },
          "nextCursor": {
            "type": [
              "null",
              "string"
            ],
            "description": "Pass as after for the next page; null on the last."
          }
        },
        "description": "A page of batches, newest first."
      },
      "BatchResponse": {
        "required": [
          "id",
          "name",
          "subject",
          "status",
          "itemCount",
          "counts",
          "createdAt",
          "admittedAt",
          "cancelRequestedAt",
          "items",
          "nextCursor"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The batch's id."
          },
          "name": {
            "type": [
              "null",
              "string"
            ],
            "description": "The batch's name."
          },
          "subject": {
            "description": "The subject requested for every item: auto, general or jewellery (auto when omitted).",
            "$ref": "#/components/schemas/JobSubject"
          },
          "status": {
            "description": "validating, processing, then completed, completed_with_failures or cancelled.",
            "$ref": "#/components/schemas/BatchStatus"
          },
          "itemCount": {
            "type": "integer",
            "description": "Items submitted, rejected ones included.",
            "format": "int32"
          },
          "counts": {
            "description": "Items by state.",
            "$ref": "#/components/schemas/BatchCountsResponse"
          },
          "createdAt": {
            "type": "string",
            "description": "When the batch was submitted.",
            "format": "date-time"
          },
          "admittedAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When every valid item had become a job; null while admission runs.",
            "format": "date-time"
          },
          "cancelRequestedAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When a cancellation was asked for.",
            "format": "date-time"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BatchItemResponse"
            },
            "description": "This page's items, in submission order."
          },
          "nextCursor": {
            "type": [
              "null",
              "string"
            ],
            "description": "Pass as after for the next page; null on the last."
          }
        },
        "description": "A batch with a page of its items. Download URLs are signed for this response only."
      },
      "BatchStatus": {
        "enum": [
          "validating",
          "processing",
          "completed",
          "completed_with_failures",
          "cancelled"
        ],
        "type": "string"
      },
      "BatchSummaryResponse": {
        "required": [
          "id",
          "name",
          "status",
          "itemCount",
          "counts",
          "createdAt",
          "admittedAt",
          "cancelRequestedAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The batch's id."
          },
          "name": {
            "type": [
              "null",
              "string"
            ],
            "description": "The batch's name."
          },
          "status": {
            "description": "The batch's status.",
            "$ref": "#/components/schemas/BatchStatus"
          },
          "itemCount": {
            "type": "integer",
            "description": "Items submitted.",
            "format": "int32"
          },
          "counts": {
            "description": "Items by state.",
            "$ref": "#/components/schemas/BatchCountsResponse"
          },
          "createdAt": {
            "type": "string",
            "description": "When the batch was submitted.",
            "format": "date-time"
          },
          "admittedAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When admission finished.",
            "format": "date-time"
          },
          "cancelRequestedAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When a cancellation was asked for.",
            "format": "date-time"
          }
        },
        "description": "A batch in a list."
      },
      "BatchValidationItemsResponse": {
        "required": [
          "valid",
          "rejected"
        ],
        "type": "object",
        "properties": {
          "valid": {
            "type": "integer",
            "description": "Items that would become jobs.",
            "format": "int32"
          },
          "rejected": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BatchItemRejectionResponse"
            },
            "description": "Items that wouldn't, by index, with the reason."
          }
        },
        "description": "The items of a dry run."
      },
      "BatchValidationResponse": {
        "required": [
          "items",
          "credits",
          "limit"
        ],
        "type": "object",
        "properties": {
          "items": {
            "description": "The valid and the rejected items.",
            "$ref": "#/components/schemas/BatchValidationItemsResponse"
          },
          "credits": {
            "description": "The credits the valid items need.",
            "$ref": "#/components/schemas/BatchCreditsResponse"
          },
          "limit": {
            "type": "integer",
            "description": "The most items a batch may hold on this account.",
            "format": "int32"
          }
        },
        "description": "A dry run (validateOnly=true): what a submission would admit and cost. Nothing was written."
      },
      "BillingOffer": {
        "enum": [
          "standard",
          "prepaid_pack"
        ],
        "type": "string"
      },
      "BillingResponse": {
        "required": [
          "subscription",
          "purchases",
          "restriction"
        ],
        "type": "object",
        "properties": {
          "subscription": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "description": "The Standard subscription; null without one.",
                "$ref": "#/components/schemas/BillingSubscriptionResponse"
              }
            ]
          },
          "purchases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchaseResponse"
            },
            "description": "Recent purchases, newest first."
          },
          "restriction": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "description": "Why new processing is paused; null unless it is.",
                "$ref": "#/components/schemas/BillingRestrictionResponse"
              }
            ]
          }
        },
        "description": "The account's billing. Amounts are in minor units of the currency (cents for USD)."
      },
      "BillingRestrictionResponse": {
        "required": [
          "category",
          "since"
        ],
        "type": "object",
        "properties": {
          "category": {
            "type": "string",
            "description": "refund, dispute or review."
          },
          "since": {
            "type": "string",
            "description": "When the restriction began.",
            "format": "date-time"
          }
        },
        "description": "Why new processing is paused until we review the account."
      },
      "BillingSubscriptionResponse": {
        "required": [
          "offer",
          "status",
          "currentPeriodStart",
          "currentPeriodEnd",
          "cancelAtPeriodEnd",
          "renewsAt",
          "endsAt"
        ],
        "type": "object",
        "properties": {
          "offer": {
            "description": "standard.",
            "$ref": "#/components/schemas/BillingOffer"
          },
          "status": {
            "description": "pending, active, past_due, on_hold, paused, cancelled, failed, expired or unknown.",
            "$ref": "#/components/schemas/SubscriptionStatus"
          },
          "currentPeriodStart": {
            "type": "string",
            "description": "The paid period's start.",
            "format": "date-time"
          },
          "currentPeriodEnd": {
            "type": "string",
            "description": "The paid period's end; its credits expire then.",
            "format": "date-time"
          },
          "cancelAtPeriodEnd": {
            "type": "boolean",
            "description": "Cancelled: it stops at the period's end."
          },
          "renewsAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "The next charge; null once nothing renews.",
            "format": "date-time"
          },
          "endsAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When the subscription stops or stopped.",
            "format": "date-time"
          }
        },
        "description": "The Standard subscription."
      },
      "CancelBatchResponse": {
        "required": [
          "id",
          "cancelled",
          "running"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The batch's id."
          },
          "cancelled": {
            "type": "integer",
            "description": "Items stopped before the GPU; their credits were released.",
            "format": "int32"
          },
          "running": {
            "type": "integer",
            "description": "Items on the GPU, asked to stop; a result stored before that takes effect is charged.",
            "format": "int32"
          }
        },
        "description": "The batch after the cancellation request."
      },
      "CancelJobResponse": {
        "required": [
          "id",
          "state",
          "executionStarted"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The job's id."
          },
          "state": {
            "description": "cancelled when it stopped before the GPU; running while a running job is asked to stop.",
            "$ref": "#/components/schemas/JobState"
          },
          "executionStarted": {
            "type": "boolean",
            "description": "The job had reached the GPU: a result stored before the cancellation takes effect is charged."
          }
        },
        "description": "The job after the cancellation request."
      },
      "CreateExportRequest": {
        "type": "object",
        "properties": {
          "jobId": {
            "type": "string",
            "description": "A succeeded job: one formatted variant of its cutout."
          },
          "batchId": {
            "type": "string",
            "description": "A batch: its succeeded items' files in ZIP parts."
          },
          "spec": {
            "description": "How to format the variant; required with jobId, and with variant in include.",
            "$ref": "#/components/schemas/ExportSpec"
          },
          "include": {
            "type": "array",
            "items": {
              "enum": [
                "cutout",
                "mask",
                "variant"
              ],
              "type": "string"
            },
            "description": "A batch's files per item: cutout, mask, variant (needs spec). Default: cutout and mask."
          },
          "manifest": {
            "type": "boolean",
            "description": "A batch's CSV manifest, a row per item, failures included. Default: true."
          }
        },
        "description": "An export: send exactly one of jobId (with spec) and batchId."
      },
      "CreateUploadRequest": {
        "required": [
          "contentType"
        ],
        "type": "object",
        "properties": {
          "contentType": {
            "enum": [
              "image/jpeg",
              "image/png",
              "image/webp"
            ],
            "type": "string",
            "description": "The file's type; the upload URL is signed for it."
          }
        },
        "description": "The image you are about to upload."
      },
      "CreateWebhookEndpointRequest": {
        "required": [
          "url"
        ],
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "A public https URL on port 443, at most 2,048 characters."
          },
          "description": {
            "type": "string",
            "description": "A note for you, at most 256 characters on one line."
          },
          "events": {
            "type": "array",
            "items": {
              "enum": [
                "job.succeeded",
                "job.failed",
                "job.cancelled",
                "batch.completed"
              ],
              "type": "string"
            },
            "description": "The event types to receive; omitted, every type known today."
          }
        },
        "description": "A webhook endpoint to register."
      },
      "CreatedWebhookEndpointResponse": {
        "required": [
          "id",
          "url",
          "description",
          "enabled",
          "events",
          "previousSecretExpiresAt",
          "createdAt",
          "updatedAt",
          "secret"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The endpoint's id."
          },
          "url": {
            "type": "string",
            "description": "Where events are POSTed."
          },
          "description": {
            "type": [
              "null",
              "string"
            ],
            "description": "Your note about it."
          },
          "enabled": {
            "type": "boolean",
            "description": "Disabled endpoints receive nothing."
          },
          "events": {
            "type": "array",
            "items": {
              "enum": [
                "job.succeeded",
                "job.failed",
                "job.cancelled",
                "batch.completed"
              ],
              "type": "string"
            },
            "description": "The event types it receives."
          },
          "previousSecretExpiresAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "Until when the secret before the last rotation still signs deliveries.",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "description": "When it was registered.",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "description": "When it last changed.",
            "format": "date-time"
          },
          "secret": {
            "type": "string",
            "description": "The signing secret, whsec_ followed by base64."
          }
        },
        "description": "The registered endpoint, with its signing secret: store it now, it is not shown again."
      },
      "CreditGrantSource": {
        "enum": [
          "trial",
          "subscription_period",
          "prepaid_pack",
          "adjustment"
        ],
        "type": "string"
      },
      "CreditGrantStatus": {
        "enum": [
          "active",
          "exhausted",
          "expired"
        ],
        "type": "string"
      },
      "CreditHistoryItemResponse": {
        "required": [
          "id",
          "kind",
          "credits",
          "grantId",
          "grantSource",
          "jobId",
          "batchId",
          "reason",
          "createdAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The entry's id."
          },
          "kind": {
            "description": "grant, reserve (work accepted), settle (work succeeded), release (work failed or was cancelled) or adjust.",
            "$ref": "#/components/schemas/CreditLedgerEntryKind"
          },
          "credits": {
            "type": "integer",
            "description": "Credits moved: positive, except an adjust that took credits back.",
            "format": "int32"
          },
          "grantId": {
            "type": "string",
            "description": "The grant the entry touched."
          },
          "grantSource": {
            "description": "That grant's source.",
            "$ref": "#/components/schemas/CreditGrantSource"
          },
          "jobId": {
            "type": [
              "null",
              "string"
            ],
            "description": "The job of a reservation's entry."
          },
          "batchId": {
            "type": [
              "null",
              "string"
            ],
            "description": "That job's batch."
          },
          "reason": {
            "type": [
              "null",
              "string"
            ],
            "description": "An adjustment's reason, written for you."
          },
          "createdAt": {
            "type": "string",
            "description": "When the entry was written.",
            "format": "date-time"
          }
        },
        "description": "A credit ledger entry."
      },
      "CreditHistoryResponse": {
        "required": [
          "items",
          "nextCursor"
        ],
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditHistoryItemResponse"
            },
            "description": "The entries on this page."
          },
          "nextCursor": {
            "type": [
              "null",
              "string"
            ],
            "description": "Pass as after for the next page; null on the last."
          }
        },
        "description": "A page of credit history, newest first."
      },
      "CreditLedgerEntryKind": {
        "enum": [
          "grant",
          "reserve",
          "settle",
          "release",
          "adjust"
        ],
        "type": "string"
      },
      "CreditTier": {
        "enum": [
          "trial",
          "paid"
        ],
        "type": "string"
      },
      "DeletionResponse": {
        "required": [
          "id",
          "state",
          "requestedAt",
          "completedAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The job's, batch's or account's id."
          },
          "state": {
            "type": "string",
            "description": "deleting or deleted."
          },
          "requestedAt": {
            "type": "string",
            "description": "When the deletion was asked for.",
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When the last file was deleted.",
            "format": "date-time"
          }
        },
        "description": "A deletion: `deleting` until every file is gone (normally within seconds, always within 24 hours), then `deleted`."
      },
      "ExportErrorResponse": {
        "required": [
          "code",
          "message"
        ],
        "type": "object",
        "properties": {
          "code": {
            "enum": [
              "file_expired",
              "output_too_large",
              "render_failed",
              "processing_failed"
            ],
            "type": "string",
            "description": "A stable code; see the export error codes."
          },
          "message": {
            "type": "string",
            "description": "For a person to read; may change."
          }
        },
        "description": "Why an export failed."
      },
      "ExportFileResponse": {
        "required": [
          "number",
          "name",
          "contentType",
          "size",
          "sha256",
          "width",
          "height",
          "expiresAt",
          "expired",
          "url",
          "urlExpiresAt"
        ],
        "type": "object",
        "properties": {
          "number": {
            "type": "integer",
            "description": "Its position, from 1.",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "description": "Its file name."
          },
          "contentType": {
            "type": "string",
            "description": "Its media type."
          },
          "size": {
            "type": "integer",
            "description": "Bytes.",
            "format": "int64"
          },
          "sha256": {
            "type": "string",
            "description": "Its SHA-256, hex, to check a download."
          },
          "width": {
            "type": [
              "null",
              "integer"
            ],
            "description": "A variant's width in pixels.",
            "format": "int32"
          },
          "height": {
            "type": [
              "null",
              "integer"
            ],
            "description": "A variant's height in pixels.",
            "format": "int32"
          },
          "expiresAt": {
            "type": "string",
            "description": "When the file is deleted.",
            "format": "date-time"
          },
          "expired": {
            "type": "boolean",
            "description": "The file is gone."
          },
          "url": {
            "type": [
              "null",
              "string"
            ],
            "description": "The file, signed for 15 minutes; null once expired.",
            "format": "uri"
          },
          "urlExpiresAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When url stops working.",
            "format": "date-time"
          }
        },
        "description": "A file of an export."
      },
      "ExportKind": {
        "enum": [
          "variant",
          "batch_zip"
        ],
        "type": "string"
      },
      "ExportListItemResponse": {
        "required": [
          "id",
          "kind",
          "state",
          "jobId",
          "batchId",
          "errorCode",
          "partCount",
          "fileCount",
          "totalBytes",
          "createdAt",
          "completedAt",
          "expiresAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The export's id."
          },
          "kind": {
            "description": "variant or batch_zip.",
            "$ref": "#/components/schemas/ExportKind"
          },
          "state": {
            "description": "queued, running, succeeded or failed.",
            "$ref": "#/components/schemas/ExportState"
          },
          "jobId": {
            "type": [
              "null",
              "string"
            ],
            "description": "A variant's job."
          },
          "batchId": {
            "type": [
              "null",
              "string"
            ],
            "description": "A ZIP export's batch."
          },
          "errorCode": {
            "enum": [
              "file_expired",
              "output_too_large",
              "render_failed",
              "processing_failed",
              null
            ],
            "type": [
              "null",
              "string"
            ],
            "description": "Why it failed; see the export error codes."
          },
          "partCount": {
            "type": "integer",
            "description": "Files made: ZIP parts, or the one variant.",
            "format": "int32"
          },
          "fileCount": {
            "type": "integer",
            "description": "The parts and the manifest; 0 until it succeeds.",
            "format": "int32"
          },
          "totalBytes": {
            "type": [
              "null",
              "integer"
            ],
            "description": "Their sizes summed; null until it succeeds.",
            "format": "int64"
          },
          "createdAt": {
            "type": "string",
            "description": "When the export was requested.",
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When it succeeded or failed.",
            "format": "date-time"
          },
          "expiresAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When its files are deleted (24 hours after completion).",
            "format": "date-time"
          }
        },
        "description": "An export in a list, without download URLs."
      },
      "ExportListResponse": {
        "required": [
          "items",
          "nextCursor"
        ],
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExportListItemResponse"
            },
            "description": "The exports on this page."
          },
          "nextCursor": {
            "type": [
              "null",
              "string"
            ],
            "description": "Pass as after for the next page; null on the last."
          }
        },
        "description": "A page of exports, newest first."
      },
      "ExportResponse": {
        "required": [
          "id",
          "kind",
          "state",
          "jobId",
          "batchId",
          "spec",
          "include",
          "manifestRequested",
          "error",
          "parts",
          "manifest",
          "cachedFrom",
          "createdAt",
          "startedAt",
          "completedAt",
          "expiresAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The export's id."
          },
          "kind": {
            "description": "variant or batch_zip.",
            "$ref": "#/components/schemas/ExportKind"
          },
          "state": {
            "description": "queued, running, succeeded or failed.",
            "$ref": "#/components/schemas/ExportState"
          },
          "jobId": {
            "type": [
              "null",
              "string"
            ],
            "description": "A variant's job."
          },
          "batchId": {
            "type": [
              "null",
              "string"
            ],
            "description": "A ZIP export's batch."
          },
          "spec": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "description": "The format, as stored; null for a ZIP export without variant.",
                "$ref": "#/components/schemas/ExportSpec"
              }
            ]
          },
          "include": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string"
            },
            "description": "A ZIP export's files per item."
          },
          "manifestRequested": {
            "type": [
              "null",
              "boolean"
            ],
            "description": "Whether a ZIP export has a manifest."
          },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "description": "Why it failed.",
                "$ref": "#/components/schemas/ExportErrorResponse"
              }
            ]
          },
          "parts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExportFileResponse"
            },
            "description": "The files: the variant, or the ZIP parts in order."
          },
          "manifest": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "description": "A ZIP export's CSV manifest.",
                "$ref": "#/components/schemas/ExportFileResponse"
              }
            ]
          },
          "cachedFrom": {
            "type": [
              "null",
              "string"
            ],
            "description": "The earlier export whose identical variant this one reuses."
          },
          "createdAt": {
            "type": "string",
            "description": "When the export was requested.",
            "format": "date-time"
          },
          "startedAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When it started running.",
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When it succeeded or failed.",
            "format": "date-time"
          },
          "expiresAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When its files are deleted (24 hours after completion).",
            "format": "date-time"
          }
        },
        "description": "An export. File URLs are signed for this response only."
      },
      "ExportSpec": {
        "type": "object",
        "properties": {
          "crop": {
            "type": "object",
            "properties": {
              "threshold": {
                "type": "integer",
                "description": "The alpha (0 to 254) a pixel must exceed to count as the product.",
                "format": "uint8",
                "default": 8
              },
              "margin": {
                "required": [
                  "value",
                  "unit"
                ],
                "type": "object",
                "properties": {
                  "value": {
                    "type": "number",
                    "description": "The distance: whole pixels, or 0 to 100 percent.",
                    "format": "double"
                  },
                  "unit": {
                    "enum": [
                      "pixels",
                      "percent"
                    ],
                    "type": "string"
                  }
                },
                "additionalProperties": false,
                "description": "A distance: whole source pixels, or a percentage (0 to 100) of the content's longer side."
              }
            },
            "additionalProperties": false
          },
          "padding": {
            "required": [
              "value",
              "unit"
            ],
            "type": "object",
            "properties": {
              "value": {
                "type": "number",
                "description": "The distance: whole pixels, or 0 to 100 percent.",
                "format": "double"
              },
              "unit": {
                "enum": [
                  "pixels",
                  "percent"
                ],
                "type": "string"
              }
            },
            "additionalProperties": false,
            "description": "A distance: whole source pixels, or a percentage (0 to 100) of the content's longer side."
          },
          "resize": {
            "type": "object",
            "properties": {
              "width": {
                "type": "integer",
                "description": "The output's width in pixels.",
                "format": "int32"
              },
              "height": {
                "type": "integer",
                "description": "The output's height in pixels.",
                "format": "int32"
              },
              "mode": {
                "enum": [
                  "fit",
                  "letterbox"
                ],
                "type": "string",
                "default": "fit"
              }
            },
            "additionalProperties": false
          },
          "placement": {
            "required": [
              "canvasWidth",
              "canvasHeight",
              "scalePercent"
            ],
            "type": "object",
            "properties": {
              "canvasWidth": {
                "type": "integer",
                "description": "The canvas's width in pixels.",
                "format": "int32"
              },
              "canvasHeight": {
                "type": "integer",
                "description": "The canvas's height in pixels.",
                "format": "int32"
              },
              "scalePercent": {
                "type": "number",
                "description": "The share of the canvas (1 to 100) the product may fill.",
                "format": "double"
              },
              "anchor": {
                "enum": [
                  "top_left",
                  "top",
                  "top_right",
                  "left",
                  "center",
                  "right",
                  "bottom_left",
                  "bottom",
                  "bottom_right"
                ],
                "type": "string",
                "default": "center"
              }
            },
            "additionalProperties": false
          },
          "background": {
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "type": "string",
            "description": "An opaque sRGB colour as #RRGGBB."
          },
          "silhouette": {
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "type": "string",
            "description": "An opaque sRGB colour as #RRGGBB."
          },
          "format": {
            "enum": [
              "png",
              "webp"
            ],
            "type": "string",
            "default": "png"
          },
          "quality": {
            "type": "integer",
            "description": "WebP's quality, 1 to 100.",
            "format": "int32",
            "default": 90
          },
          "lossless": {
            "type": "boolean",
            "description": "Lossless WebP.",
            "default": false
          },
          "maxUpscale": {
            "type": "number",
            "description": "How far a resize or placement may enlarge the product: 1 never enlarges.",
            "format": "double",
            "default": 1
          }
        },
        "additionalProperties": false,
        "description": "How to format a variant. The steps run in this order: silhouette, crop, padding, resize or placement, background, encode; resize and placement exclude each other. Without a background the variant stays transparent."
      },
      "ExportState": {
        "enum": [
          "queued",
          "running",
          "succeeded",
          "failed"
        ],
        "type": "string"
      },
      "IssueReportListResponse": {
        "required": [
          "items",
          "nextCursor"
        ],
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IssueReportResponse"
            },
            "description": "The reports on this page."
          },
          "nextCursor": {
            "type": [
              "null",
              "string"
            ],
            "description": "Pass as after for the next page; null on the last."
          }
        },
        "description": "A page of reports, newest first."
      },
      "IssueReportReason": {
        "enum": [
          "edges",
          "missing_part",
          "background_left",
          "other"
        ],
        "type": "string"
      },
      "IssueReportResponse": {
        "required": [
          "id",
          "jobId",
          "batchId",
          "reason",
          "note",
          "state",
          "createdAt",
          "resolvedAt",
          "resolutionReason"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The report's id."
          },
          "jobId": {
            "type": "string",
            "description": "The reported job."
          },
          "batchId": {
            "type": [
              "null",
              "string"
            ],
            "description": "The job's batch."
          },
          "reason": {
            "description": "edges, missing_part, background_left or other.",
            "$ref": "#/components/schemas/IssueReportReason"
          },
          "note": {
            "type": [
              "null",
              "string"
            ],
            "description": "Your note."
          },
          "state": {
            "description": "open, resolved_restored (the credit was restored) or resolved_declined.",
            "$ref": "#/components/schemas/IssueReportState"
          },
          "createdAt": {
            "type": "string",
            "description": "When it was reported.",
            "format": "date-time"
          },
          "resolvedAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When it was resolved.",
            "format": "date-time"
          },
          "resolutionReason": {
            "type": [
              "null",
              "string"
            ],
            "description": "Our answer, written for you."
          }
        },
        "description": "An issue report. A restored credit shows in the credit history as an adjust entry."
      },
      "IssueReportState": {
        "enum": [
          "open",
          "resolved_restored",
          "resolved_declined"
        ],
        "type": "string"
      },
      "JobBatchResponse": {
        "required": [
          "id",
          "index",
          "sku",
          "filename"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The batch's id."
          },
          "index": {
            "type": "integer",
            "description": "The item's position in the submission, from 0.",
            "format": "int32"
          },
          "sku": {
            "type": [
              "null",
              "string"
            ],
            "description": "The SKU sent with the item."
          },
          "filename": {
            "type": [
              "null",
              "string"
            ],
            "description": "The filename sent with the item."
          }
        },
        "description": "The batch item a job is."
      },
      "JobErrorResponse": {
        "required": [
          "code",
          "message"
        ],
        "type": "object",
        "properties": {
          "code": {
            "enum": [
              "invalid_input",
              "file_too_large",
              "too_many_pixels",
              "unsupported_format",
              "unsafe_url",
              "fetch_failed",
              "processing_failed",
              "credits_revoked",
              "job_timed_out"
            ],
            "type": "string",
            "description": "A stable code; see the job error codes."
          },
          "message": {
            "type": "string",
            "description": "For a person to read; may change."
          }
        },
        "description": "Why a job failed."
      },
      "JobEventData": {
        "required": [
          "jobId",
          "state"
        ],
        "type": "object",
        "properties": {
          "jobId": {
            "type": "string",
            "description": "The job."
          },
          "batchId": {
            "type": "string",
            "description": "The job's batch, for a batch item; absent for a single job."
          },
          "state": {
            "enum": [
              "succeeded",
              "failed",
              "cancelled"
            ],
            "type": "string",
            "description": "The job's terminal state."
          },
          "errorCode": {
            "enum": [
              "invalid_input",
              "file_too_large",
              "too_many_pixels",
              "unsupported_format",
              "unsafe_url",
              "fetch_failed",
              "processing_failed",
              "credits_revoked",
              "job_timed_out"
            ],
            "type": "string",
            "description": "Why it failed, for job.failed; absent otherwise."
          }
        },
        "description": "`data` of job.succeeded, job.failed and job.cancelled."
      },
      "JobInputResponse": {
        "required": [
          "type",
          "uploadId",
          "url",
          "downloadUrl",
          "expiresAt"
        ],
        "type": "object",
        "properties": {
          "type": {
            "description": "upload or url.",
            "$ref": "#/components/schemas/JobInputType"
          },
          "uploadId": {
            "type": [
              "null",
              "string"
            ],
            "description": "The upload's id, for an upload."
          },
          "url": {
            "type": [
              "null",
              "string"
            ],
            "description": "The image URL, for a url input."
          },
          "downloadUrl": {
            "type": [
              "null",
              "string"
            ],
            "description": "The original, signed for 15 minutes; null until it is stored and validated, and after expiresAt.",
            "format": "uri"
          },
          "expiresAt": {
            "type": "string",
            "description": "When the original is deleted (7 days after it was stored).",
            "format": "date-time"
          }
        },
        "description": "A job's input."
      },
      "JobInputType": {
        "enum": [
          "upload",
          "url"
        ],
        "type": "string"
      },
      "JobIssueReportsResponse": {
        "required": [
          "items"
        ],
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IssueReportResponse"
            },
            "description": "The reports."
          }
        },
        "description": "A job's reports, newest first."
      },
      "JobListItemResponse": {
        "required": [
          "id",
          "state",
          "errorCode",
          "createdAt",
          "completedAt",
          "batchId",
          "itemIndex",
          "sku",
          "filename",
          "source",
          "batch"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The job's id."
          },
          "state": {
            "description": "The job's state.",
            "$ref": "#/components/schemas/JobState"
          },
          "errorCode": {
            "enum": [
              "invalid_input",
              "file_too_large",
              "too_many_pixels",
              "unsupported_format",
              "unsafe_url",
              "fetch_failed",
              "processing_failed",
              "credits_revoked",
              "job_timed_out",
              null
            ],
            "type": [
              "null",
              "string"
            ],
            "description": "Why it failed; null unless failed."
          },
          "createdAt": {
            "type": "string",
            "description": "When the job was submitted.",
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When it reached a terminal state.",
            "format": "date-time"
          },
          "batchId": {
            "type": [
              "null",
              "string"
            ],
            "description": "The batch's id, for a batch item."
          },
          "itemIndex": {
            "type": [
              "null",
              "integer"
            ],
            "description": "The item's index, for a batch item.",
            "format": "int32"
          },
          "sku": {
            "type": [
              "null",
              "string"
            ],
            "description": "The item's SKU, for a batch item."
          },
          "filename": {
            "type": [
              "null",
              "string"
            ],
            "description": "The item's filename, for a batch item."
          },
          "source": {
            "description": "Where the image came from.",
            "$ref": "#/components/schemas/JobListSourceResponse"
          },
          "batch": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "description": "The batch item this job is; null for a single job.",
                "$ref": "#/components/schemas/JobBatchResponse"
              }
            ]
          }
        },
        "description": "A job in a list, without download URLs."
      },
      "JobListResponse": {
        "required": [
          "items",
          "nextCursor"
        ],
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobListItemResponse"
            },
            "description": "The jobs on this page."
          },
          "nextCursor": {
            "type": [
              "null",
              "string"
            ],
            "description": "Pass as after for the next page; null on the last."
          }
        },
        "description": "A page of jobs, newest first."
      },
      "JobListSourceResponse": {
        "required": [
          "kind",
          "url"
        ],
        "type": "object",
        "properties": {
          "kind": {
            "description": "upload or url.",
            "$ref": "#/components/schemas/JobInputType"
          },
          "url": {
            "type": [
              "null",
              "string"
            ],
            "description": "A url input's host and path, without query string."
          }
        },
        "description": "Where a listed job's image came from."
      },
      "JobOutputType": {
        "enum": [
          "cutout",
          "mask",
          "preview"
        ],
        "type": "string"
      },
      "JobResponse": {
        "required": [
          "id",
          "state",
          "input",
          "error",
          "attempts",
          "subject",
          "modelVersion",
          "sourceHash",
          "source",
          "cancelRequestedAt",
          "createdAt",
          "updatedAt",
          "completedAt",
          "results",
          "batch"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The job's id."
          },
          "state": {
            "description": "awaiting_upload, validating, queued, running, then succeeded, failed or cancelled.",
            "$ref": "#/components/schemas/JobState"
          },
          "input": {
            "description": "What the job processes.",
            "$ref": "#/components/schemas/JobInputResponse"
          },
          "error": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "description": "Why it failed; null unless failed.",
                "$ref": "#/components/schemas/JobErrorResponse"
              }
            ]
          },
          "attempts": {
            "type": "integer",
            "description": "GPU attempts so far; technical failures are retried automatically, and never charged twice.",
            "format": "int32"
          },
          "subject": {
            "description": "The subject requested and the one used.",
            "$ref": "#/components/schemas/JobSubjectResponse"
          },
          "modelVersion": {
            "type": [
              "null",
              "string"
            ],
            "description": "The model that produced the result; null before processing."
          },
          "sourceHash": {
            "type": [
              "null",
              "string"
            ],
            "description": "The source bytes' hash as sha256:<hex>; null until validated."
          },
          "source": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "description": "The validated source image; null until validated.",
                "$ref": "#/components/schemas/JobSourceResponse"
              }
            ]
          },
          "cancelRequestedAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When a cancellation was asked for.",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "description": "When the job was submitted.",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "description": "When the job last changed.",
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When it reached a terminal state.",
            "format": "date-time"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobResultResponse"
            },
            "description": "The outputs of a succeeded job: cutout, mask and, when rendered, preview."
          },
          "batch": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "description": "The batch item this job is; null for a single job.",
                "$ref": "#/components/schemas/JobBatchResponse"
              }
            ]
          }
        },
        "description": "A job. Download URLs are signed for this response only."
      },
      "JobResultResponse": {
        "required": [
          "assetId",
          "type",
          "width",
          "height",
          "expiresAt",
          "url"
        ],
        "type": "object",
        "properties": {
          "assetId": {
            "type": "string",
            "description": "The output's id: store this, and read GET /v1/assets/{id} for a fresh URL."
          },
          "type": {
            "description": "cutout (transparent PNG), mask (8-bit alpha PNG) or preview (WebP within 320×320).",
            "$ref": "#/components/schemas/JobOutputType"
          },
          "width": {
            "type": "integer",
            "description": "Pixels.",
            "format": "int32"
          },
          "height": {
            "type": "integer",
            "description": "Pixels.",
            "format": "int32"
          },
          "expiresAt": {
            "type": "string",
            "description": "When the file is deleted (30 days after the job completed).",
            "format": "date-time"
          },
          "url": {
            "type": [
              "null",
              "string"
            ],
            "description": "The file, signed for 15 minutes; null once expired.",
            "format": "uri"
          }
        },
        "description": "One output of a succeeded job."
      },
      "JobSourceResponse": {
        "required": [
          "format",
          "width",
          "height",
          "bytes"
        ],
        "type": "object",
        "properties": {
          "format": {
            "type": "string",
            "description": "jpeg, png or webp."
          },
          "width": {
            "type": "integer",
            "description": "Pixels, upright (the EXIF orientation applied).",
            "format": "int32"
          },
          "height": {
            "type": "integer",
            "description": "Pixels, upright.",
            "format": "int32"
          },
          "bytes": {
            "type": "integer",
            "description": "The file's size.",
            "format": "int64"
          }
        },
        "description": "The source image as validation decoded it."
      },
      "JobState": {
        "enum": [
          "awaiting_upload",
          "validating",
          "queued",
          "running",
          "succeeded",
          "failed",
          "cancelled"
        ],
        "type": "string"
      },
      "JobSubject": {
        "enum": [
          "auto",
          "general",
          "jewellery"
        ],
        "type": "string"
      },
      "JobSubjectResponse": {
        "required": [
          "requested",
          "used",
          "detected"
        ],
        "type": "object",
        "properties": {
          "requested": {
            "description": "auto, general or jewellery, as submitted (auto when omitted).",
            "$ref": "#/components/schemas/JobSubject"
          },
          "used": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "description": "general or jewellery; null until the input is validated.",
                "$ref": "#/components/schemas/JobSubject"
              }
            ]
          },
          "detected": {
            "type": [
              "null",
              "boolean"
            ],
            "description": "Whether the automatic check chose the subject used: true for an auto request it answered; false when you set the subject or the check gave no answer (then general is used); null until validated."
          }
        },
        "description": "A job's subject: what the request asked for, and what processing uses."
      },
      "LimitsResponse": {
        "required": [
          "tier",
          "batchMaxItems",
          "inFlight",
          "maxUploadBytes",
          "maxPixels",
          "maxUrlLength"
        ],
        "type": "object",
        "properties": {
          "tier": {
            "description": "trial until the first Standard period or prepaid pack, then paid.",
            "$ref": "#/components/schemas/CreditTier"
          },
          "batchMaxItems": {
            "type": "integer",
            "description": "Items per POST /v1/batches.",
            "format": "int32"
          },
          "inFlight": {
            "type": "integer",
            "description": "Jobs on the GPU at once; more stay queued.",
            "format": "int32"
          },
          "maxUploadBytes": {
            "type": "integer",
            "description": "Bytes per source image, upload or URL.",
            "format": "int64"
          },
          "maxPixels": {
            "type": "integer",
            "description": "Pixels (width × height) per source image.",
            "format": "int64"
          },
          "maxUrlLength": {
            "type": "integer",
            "description": "Characters of an image URL.",
            "format": "int32"
          }
        },
        "description": "The account's limits."
      },
      "Problem": {
        "required": [
          "type",
          "title",
          "status",
          "code"
        ],
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "A URI for the HTTP status."
          },
          "title": {
            "type": "string",
            "description": "The HTTP status in words."
          },
          "status": {
            "type": "integer",
            "description": "The HTTP status code.",
            "format": "int32"
          },
          "detail": {
            "type": "string",
            "description": "What went wrong, for a person to read; may change. Branch on `code`."
          },
          "code": {
            "$ref": "#/components/schemas/ProblemCode"
          },
          "traceId": {
            "type": "string",
            "description": "The request's trace id, to quote when you ask us about it."
          },
          "requested": {
            "type": "integer",
            "description": "insufficient_credits and batch_too_large: the credits or items the request needed.",
            "format": "int32"
          },
          "available": {
            "type": "integer",
            "description": "insufficient_credits: the credits the account has available.",
            "format": "int32"
          },
          "shortfall": {
            "type": "integer",
            "description": "insufficient_credits on a batch: the credits missing.",
            "format": "int32"
          },
          "limit": {
            "type": "integer",
            "description": "batch_too_large: the most items a batch may hold on this account.",
            "format": "int32"
          },
          "reportId": {
            "type": "string",
            "description": "report_already_open: the open report."
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "invalid_request on an export: one `spec.<field>: <message>` per problem."
          },
          "rejected": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BatchItemRejectionResponse"
            },
            "description": "invalid_request on a batch with no valid item: each item's rejection."
          }
        },
        "description": "An error as `application/problem+json` (RFC 9457), with the stable `code`."
      },
      "ProblemCode": {
        "enum": [
          "invalid_request",
          "unauthenticated",
          "insufficient_credits",
          "not_found",
          "unsupported_media_type",
          "rate_limited",
          "internal_error",
          "idempotency_key_required",
          "idempotency_key_reused",
          "account_restricted",
          "unsafe_url",
          "account_closed",
          "job_in_batch",
          "file_expired",
          "job_not_cancellable",
          "job_not_succeeded",
          "report_already_open",
          "webhook_endpoint_limit_reached",
          "batch_too_large",
          "unknown_subject"
        ],
        "type": "string",
        "description": "A stable error code: branch on it. A published code never changes meaning; new codes may be added, so treat an unknown one by its HTTP status."
      },
      "PurchaseResponse": {
        "required": [
          "id",
          "offer",
          "status",
          "amount",
          "currency",
          "purchasedAt",
          "periodStart",
          "periodEnd",
          "refundedAmount",
          "disputed",
          "disputeState",
          "disputeOpenedAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The purchase's id."
          },
          "offer": {
            "description": "standard or prepaid_pack.",
            "$ref": "#/components/schemas/BillingOffer"
          },
          "status": {
            "description": "pending, succeeded, failed or cancelled.",
            "$ref": "#/components/schemas/PurchaseStatus"
          },
          "amount": {
            "type": "integer",
            "description": "The amount paid, in minor units.",
            "format": "int64"
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217, such as USD."
          },
          "purchasedAt": {
            "type": "string",
            "description": "When it was bought.",
            "format": "date-time"
          },
          "periodStart": {
            "type": [
              "null",
              "string"
            ],
            "description": "A subscription payment's period start.",
            "format": "date-time"
          },
          "periodEnd": {
            "type": [
              "null",
              "string"
            ],
            "description": "A subscription payment's period end.",
            "format": "date-time"
          },
          "refundedAmount": {
            "type": "integer",
            "description": "The amount refunded, in minor units.",
            "format": "int64"
          },
          "disputed": {
            "type": "boolean",
            "description": "A dispute was opened."
          },
          "disputeState": {
            "type": "string",
            "description": "none, open, won or lost."
          },
          "disputeOpenedAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When the dispute was opened.",
            "format": "date-time"
          }
        },
        "description": "A purchase."
      },
      "PurchaseStatus": {
        "enum": [
          "pending",
          "succeeded",
          "failed",
          "cancelled"
        ],
        "type": "string"
      },
      "QueueResponse": {
        "required": [
          "awaitingUpload",
          "validating",
          "queued",
          "running",
          "inFlightLimit",
          "tier",
          "oldestQueued"
        ],
        "type": "object",
        "properties": {
          "awaitingUpload": {
            "type": "integer",
            "description": "Jobs waiting for their upload's bytes.",
            "format": "int64"
          },
          "validating": {
            "type": "integer",
            "description": "Jobs being fetched or checked.",
            "format": "int64"
          },
          "queued": {
            "type": "integer",
            "description": "Jobs waiting for a GPU slot.",
            "format": "int64"
          },
          "running": {
            "type": "integer",
            "description": "Jobs on the GPU; at most inFlightLimit at once.",
            "format": "int64"
          },
          "inFlightLimit": {
            "type": "integer",
            "description": "How many of the account's jobs run at once at its tier; more stay queued.",
            "format": "int32"
          },
          "tier": {
            "description": "trial or paid.",
            "$ref": "#/components/schemas/CreditTier"
          },
          "oldestQueued": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "description": "The job queued longest; null when none is queued.",
                "$ref": "#/components/schemas/QueuedJobResponse"
              }
            ]
          }
        },
        "description": "The account's unfinished jobs."
      },
      "QueuedJobResponse": {
        "required": [
          "jobId",
          "createdAt",
          "ageSeconds"
        ],
        "type": "object",
        "properties": {
          "jobId": {
            "type": "string",
            "description": "The job's id."
          },
          "createdAt": {
            "type": "string",
            "description": "When it was submitted.",
            "format": "date-time"
          },
          "ageSeconds": {
            "type": "integer",
            "description": "Whole seconds since it was submitted, as of this response.",
            "format": "int64"
          }
        },
        "description": "The job queued longest."
      },
      "ReportIssueRequest": {
        "required": [
          "reason"
        ],
        "type": "object",
        "properties": {
          "reason": {
            "enum": [
              "edges",
              "missing_part",
              "background_left",
              "other"
            ],
            "type": "string",
            "description": "edges (cut into the product or a fringe left), missing_part, background_left or other."
          },
          "note": {
            "type": "string",
            "description": "Plain text, at most 1,000 characters."
          }
        },
        "description": "What is wrong with the result."
      },
      "RetryBatchResponse": {
        "required": [
          "id",
          "retried",
          "rejected"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The batch's id."
          },
          "retried": {
            "type": "integer",
            "description": "Items retried as new jobs, one credit reserved each.",
            "format": "int32"
          },
          "rejected": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BatchItemRejectionResponse"
            },
            "description": "Failed items that couldn't be retried (an expired input, say), by index."
          }
        },
        "description": "The retry's outcome."
      },
      "RotatedWebhookSecretResponse": {
        "required": [
          "id",
          "secret",
          "previousSecretExpiresAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The endpoint's id."
          },
          "secret": {
            "type": "string",
            "description": "The new signing secret, whsec_ followed by base64."
          },
          "previousSecretExpiresAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "Until when the previous secret still signs deliveries (24 hours).",
            "format": "date-time"
          }
        },
        "description": "The new signing secret: store it now, it is not shown again."
      },
      "SubmitBatchItemRequest": {
        "type": "object",
        "properties": {
          "uploadId": {
            "type": "string",
            "description": "The uploadId from POST /v1/uploads."
          },
          "url": {
            "type": "string",
            "description": "A public https image URL on port 443, at most 2,048 characters."
          },
          "sku": {
            "type": "string",
            "description": "Your SKU, 1 to 255 characters; kept for the manifest and download names."
          },
          "filename": {
            "type": "string",
            "description": "The original filename, 1 to 255 characters; kept for the manifest and download names."
          }
        },
        "description": "One image of a batch: send exactly one of uploadId and url."
      },
      "SubmitBatchRequest": {
        "required": [
          "items"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "A name for the batch, 1 to 200 characters."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SubmitBatchItemRequest"
            },
            "description": "The images, at least one; at most the account's batch limit (GET /v1/limits)."
          },
          "subject": {
            "enum": [
              "auto",
              "general",
              "jewellery"
            ],
            "type": "string",
            "description": "What the image shows, for the model that processes it: auto (the default) checks each image for jewellery and uses the jewellery model for rings, earrings, necklaces, bracelets and watches; general or jewellery is your statement and skips the check. Products other than jewellery set to jewellery may come out worse. Omitted is auto, and the same request. It applies to every item."
          }
        },
        "description": "A batch of images."
      },
      "SubmitImageRequest": {
        "type": "object",
        "properties": {
          "uploadId": {
            "type": "string",
            "description": "The uploadId from POST /v1/uploads; PUT the bytes before the upload URL expires."
          },
          "url": {
            "type": "string",
            "description": "A public https image URL on port 443, at most 2,048 characters; private and internal addresses are refused."
          },
          "subject": {
            "enum": [
              "auto",
              "general",
              "jewellery"
            ],
            "type": "string",
            "description": "What the image shows, for the model that processes it: auto (the default) checks each image for jewellery and uses the jewellery model for rings, earrings, necklaces, bracelets and watches; general or jewellery is your statement and skips the check. Products other than jewellery set to jewellery may come out worse. Omitted is auto, and the same request."
          }
        },
        "description": "One image to process: send exactly one of uploadId and url."
      },
      "SubscriptionStatus": {
        "enum": [
          "pending",
          "active",
          "past_due",
          "on_hold",
          "paused",
          "cancelled",
          "failed",
          "expired",
          "unknown"
        ],
        "type": "string"
      },
      "UpdateWebhookEndpointRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "A new public https URL."
          },
          "description": {
            "type": "string",
            "description": "A new note; an empty string clears it."
          },
          "enabled": {
            "type": "boolean",
            "description": "false stops deliveries; true resumes them."
          },
          "events": {
            "type": "array",
            "items": {
              "enum": [
                "job.succeeded",
                "job.failed",
                "job.cancelled",
                "batch.completed"
              ],
              "type": "string"
            },
            "description": "The event types to receive."
          }
        },
        "description": "Changes to a webhook endpoint; omitted fields stay as they are."
      },
      "UploadResponse": {
        "required": [
          "uploadId",
          "url",
          "method",
          "headers",
          "urlExpiresAt",
          "expiresAt"
        ],
        "type": "object",
        "properties": {
          "uploadId": {
            "type": "string",
            "description": "The upload's id, for the submission."
          },
          "url": {
            "type": "string",
            "description": "The signed storage URL; it takes one PUT of this file.",
            "format": "uri"
          },
          "method": {
            "type": "string",
            "description": "Always PUT."
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Headers the PUT must carry exactly (Content-Type)."
          },
          "urlExpiresAt": {
            "type": "string",
            "description": "When the URL stops working (15 minutes).",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "description": "When the stored original is deleted (7 days); an upload no job took is deleted 24 hours after its URL expired.",
            "format": "date-time"
          }
        },
        "description": "Where to send the bytes: PUT the file to url with exactly these headers before urlExpiresAt, then submit uploadId to POST /v1/images or POST /v1/batches."
      },
      "UsageGrantResponse": {
        "required": [
          "id",
          "source",
          "amount",
          "remaining",
          "reserved",
          "consumed",
          "debited",
          "grantedAt",
          "expiresAt",
          "status"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The grant's id."
          },
          "source": {
            "description": "trial, subscription_period, prepaid_pack or adjustment.",
            "$ref": "#/components/schemas/CreditGrantSource"
          },
          "amount": {
            "type": "integer",
            "description": "Credits granted.",
            "format": "int32"
          },
          "remaining": {
            "type": "integer",
            "description": "Credits left: amount minus reserved, consumed and debited.",
            "format": "int32"
          },
          "reserved": {
            "type": "integer",
            "description": "Credits held by unfinished work.",
            "format": "int32"
          },
          "consumed": {
            "type": "integer",
            "description": "Credits consumed.",
            "format": "int32"
          },
          "debited": {
            "type": "integer",
            "description": "Credits taken back (a refund, a dispute or an adjustment).",
            "format": "int32"
          },
          "grantedAt": {
            "type": "string",
            "description": "When the credits were granted.",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "description": "When the remaining credits expire.",
            "format": "date-time"
          },
          "status": {
            "description": "active (credits left), exhausted (none left) or expired.",
            "$ref": "#/components/schemas/CreditGrantStatus"
          }
        },
        "description": "A grant of credits."
      },
      "UsageResponse": {
        "required": [
          "available",
          "reserved",
          "consumed",
          "grants"
        ],
        "type": "object",
        "properties": {
          "available": {
            "type": "integer",
            "description": "Credits you can spend now: the active grants' remaining credits.",
            "format": "int32"
          },
          "reserved": {
            "type": "integer",
            "description": "Credits held by accepted work that hasn't finished.",
            "format": "int32"
          },
          "consumed": {
            "type": "integer",
            "description": "Credits consumed by succeeded work, over the account's lifetime.",
            "format": "int32"
          },
          "grants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UsageGrantResponse"
            },
            "description": "Every grant, in spending order (earliest expiry first)."
          }
        },
        "description": "The account's credits. One image consumes one credit, reserved when it is accepted and consumed once its outputs are stored."
      },
      "WebhookAttempt": {
        "required": [
          "at",
          "statusCode",
          "error",
          "latencyMilliseconds"
        ],
        "type": "object",
        "properties": {
          "at": {
            "type": "string",
            "description": "When the attempt was made.",
            "format": "date-time"
          },
          "statusCode": {
            "type": [
              "null",
              "integer"
            ],
            "description": "The status the endpoint answered; null when it answered none.",
            "format": "int32"
          },
          "error": {
            "type": [
              "null",
              "string"
            ],
            "description": "Why there was no answer: timeout, unreachable, unsafe_url, endpoint_disabled, endpoint_deleted or internal_error; null when it answered."
          },
          "latencyMilliseconds": {
            "type": "integer",
            "description": "How long the attempt took.",
            "format": "int32"
          }
        }
      },
      "WebhookDeliveryPageResponse": {
        "required": [
          "items",
          "nextCursor"
        ],
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookDeliveryResponse"
            },
            "description": "The deliveries on this page."
          },
          "nextCursor": {
            "type": [
              "null",
              "string"
            ],
            "description": "Pass as cursor for the next page; null on the last."
          }
        },
        "description": "A page of deliveries, newest first."
      },
      "WebhookDeliveryResponse": {
        "required": [
          "id",
          "eventId",
          "eventType",
          "state",
          "attempts",
          "lastStatusCode",
          "lastError",
          "lastAttemptAt",
          "nextAttemptAt",
          "createdAt",
          "completedAt",
          "data",
          "attemptLog"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The delivery's id."
          },
          "eventId": {
            "type": "string",
            "description": "The event's id, sent as webhook-id."
          },
          "eventType": {
            "enum": [
              "job.succeeded",
              "job.failed",
              "job.cancelled",
              "batch.completed"
            ],
            "type": "string",
            "description": "The event's type."
          },
          "state": {
            "description": "pending, delivering, succeeded or failed (out of attempts, refused with a 4xx, or not sendable).",
            "$ref": "#/components/schemas/WebhookDeliveryState"
          },
          "attempts": {
            "type": "integer",
            "description": "Attempts so far.",
            "format": "int32"
          },
          "lastStatusCode": {
            "type": [
              "null",
              "integer"
            ],
            "description": "The status the endpoint last answered.",
            "format": "int32"
          },
          "lastError": {
            "type": [
              "null",
              "string"
            ],
            "description": "Why the last attempt got no answer: timeout, unreachable, unsafe_url, endpoint_disabled, endpoint_deleted or internal_error."
          },
          "lastAttemptAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When it was last tried.",
            "format": "date-time"
          },
          "nextAttemptAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When it is tried next; only while a retry is pending.",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "description": "When the event was published to the endpoint.",
            "format": "date-time"
          },
          "completedAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "When it succeeded or failed for good.",
            "format": "date-time"
          },
          "data": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobEventData"
              },
              {
                "$ref": "#/components/schemas/BatchEventData"
              }
            ],
            "description": "The event's `data` as sent: JobEventData for job events, BatchEventData for batch.completed."
          },
          "attemptLog": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookAttempt"
            },
            "description": "Every attempt, oldest first."
          }
        },
        "description": "One event's delivery to the endpoint."
      },
      "WebhookDeliveryState": {
        "enum": [
          "pending",
          "delivering",
          "succeeded",
          "failed"
        ],
        "type": "string"
      },
      "WebhookEndpointListItemResponse": {
        "required": [
          "id",
          "url",
          "description",
          "enabled",
          "events",
          "previousSecretExpiresAt",
          "createdAt",
          "updatedAt",
          "lastDelivery"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The endpoint's id."
          },
          "url": {
            "type": "string",
            "description": "Where events are POSTed."
          },
          "description": {
            "type": [
              "null",
              "string"
            ],
            "description": "Your note about it."
          },
          "enabled": {
            "type": "boolean",
            "description": "Disabled endpoints receive nothing."
          },
          "events": {
            "type": "array",
            "items": {
              "enum": [
                "job.succeeded",
                "job.failed",
                "job.cancelled",
                "batch.completed"
              ],
              "type": "string"
            },
            "description": "The event types it receives."
          },
          "previousSecretExpiresAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "Until when the secret before the last rotation still signs deliveries.",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "description": "When it was registered.",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "description": "When it last changed.",
            "format": "date-time"
          },
          "lastDelivery": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "description": "Its newest delivery; null before the first.",
                "$ref": "#/components/schemas/WebhookLastDelivery"
              }
            ]
          }
        },
        "description": "A listed webhook endpoint with its newest delivery."
      },
      "WebhookEndpointListResponse": {
        "required": [
          "items"
        ],
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEndpointListItemResponse"
            },
            "description": "The endpoints."
          }
        },
        "description": "The account's webhook endpoints."
      },
      "WebhookEndpointResponse": {
        "required": [
          "id",
          "url",
          "description",
          "enabled",
          "events",
          "previousSecretExpiresAt",
          "createdAt",
          "updatedAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The endpoint's id."
          },
          "url": {
            "type": "string",
            "description": "Where events are POSTed."
          },
          "description": {
            "type": [
              "null",
              "string"
            ],
            "description": "Your note about it."
          },
          "enabled": {
            "type": "boolean",
            "description": "Disabled endpoints receive nothing."
          },
          "events": {
            "type": "array",
            "items": {
              "enum": [
                "job.succeeded",
                "job.failed",
                "job.cancelled",
                "batch.completed"
              ],
              "type": "string"
            },
            "description": "The event types it receives."
          },
          "previousSecretExpiresAt": {
            "type": [
              "null",
              "string"
            ],
            "description": "Until when the secret before the last rotation still signs deliveries.",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "description": "When it was registered.",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "description": "When it last changed.",
            "format": "date-time"
          }
        },
        "description": "A webhook endpoint. Its signing secret is never shown again after creation or rotation."
      },
      "WebhookLastDelivery": {
        "required": [
          "state",
          "at",
          "statusCode",
          "attempts"
        ],
        "type": "object",
        "properties": {
          "state": {
            "description": "pending, delivering, succeeded or failed.",
            "$ref": "#/components/schemas/WebhookDeliveryState"
          },
          "at": {
            "type": "string",
            "description": "When it last moved: its last attempt, or when it was queued.",
            "format": "date-time"
          },
          "statusCode": {
            "type": [
              "null",
              "integer"
            ],
            "description": "The status the endpoint last answered.",
            "format": "int32"
          },
          "attempts": {
            "type": "integer",
            "description": "Attempts so far; a pending delivery with attempts is a retry.",
            "format": "int32"
          }
        }
      }
    },
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "description": "An API key from the dashboard (`iak_live_…`), sent as `Authorization: Bearer <key>`. Shown once when it is created; revoking it takes effect on its next request.",
        "scheme": "bearer"
      }
    }
  },
  "tags": [
    {
      "name": "Uploads",
      "description": "Allocate an input and send its bytes straight to storage with the signed URL."
    },
    {
      "name": "Jobs",
      "description": "One image, processed asynchronously: submit, read, list, cancel, delete, and the account's queue."
    },
    {
      "name": "Batches",
      "description": "Many images as one batch: a dry run, submission, items page by page, cancel, retry of technical failures, deletion."
    },
    {
      "name": "Exports",
      "description": "Formatted variants and batch ZIP files, made from stored outputs on the CPU: no credits, no new inference."
    },
    {
      "name": "Assets",
      "description": "One stored file by its asset id, with a freshly signed download URL."
    },
    {
      "name": "Credits",
      "description": "Available, reserved and consumed credits, the grants with their expiry, and the credit history."
    },
    {
      "name": "Limits",
      "description": "The account's limits at its tier, read from what enforces them."
    },
    {
      "name": "Webhooks",
      "description": "Account-owned endpoints that receive signed event deliveries, and their delivery log."
    },
    {
      "name": "Reports",
      "description": "Report a poor result on a succeeded job; we review it and may restore its credit."
    },
    {
      "name": "Account",
      "description": "The account's status and, once deleted, the deletion's progress."
    },
    {
      "name": "Billing",
      "description": "The subscription, recent purchases and any pause on new processing."
    }
  ]
}
