{
  "components": {
    "schemas": {
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "title": "Detail",
            "type": "array"
          }
        },
        "title": "HTTPValidationError",
        "type": "object"
      },
      "IngestItemStageEnum": {
        "description": "Where a persisted record currently sits, or where it failed.\n\nNo ``validate`` stage: a request with any invalid record is rejected whole (422) and leaves no ledger.",
        "enum": [
          "persist",
          "calculate",
          "delete"
        ],
        "title": "IngestItemStageEnum",
        "type": "string"
      },
      "IngestItemStatusEnum": {
        "description": "Outcome of a submitted record at its current stage.",
        "enum": [
          "pending",
          "succeeded",
          "failed",
          "skipped"
        ],
        "title": "IngestItemStatusEnum",
        "type": "string"
      },
      "IngestJobCountsSch": {
        "description": "Record counters of a job.",
        "properties": {
          "failed": {
            "description": "Failed to calculate; the entity exists without emissions.",
            "title": "Failed",
            "type": "integer"
          },
          "submitted": {
            "description": "Records in the request; all of them passed validation and were written.",
            "title": "Submitted",
            "type": "integer"
          },
          "succeeded": {
            "title": "Succeeded",
            "type": "integer"
          }
        },
        "required": [
          "submitted",
          "succeeded",
          "failed"
        ],
        "title": "IngestJobCountsSch",
        "type": "object"
      },
      "IngestJobItemSch": {
        "description": "What happened to one submitted record.",
        "properties": {
          "attempt_count": {
            "title": "Attempt Count",
            "type": "integer"
          },
          "chunk_index": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Chunk Index"
          },
          "client_row_id": {
            "anyOf": [
              {
                "maxLength": 255,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional client key, echoed on every result for this record.",
            "title": "Client Row Id"
          },
          "entity_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Entity Id"
          },
          "error_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Stable, translatable error code.",
            "title": "Error Code"
          },
          "error_params": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Values that explain the error.",
            "title": "Error Params"
          },
          "source_row_index": {
            "description": "Position of the record in the submitted array.",
            "minimum": 0.0,
            "title": "Source Row Index",
            "type": "integer"
          },
          "stage": {
            "$ref": "#/components/schemas/IngestItemStageEnum"
          },
          "status": {
            "$ref": "#/components/schemas/IngestItemStatusEnum"
          }
        },
        "required": [
          "source_row_index",
          "client_row_id",
          "chunk_index",
          "stage",
          "status",
          "entity_id",
          "error_code",
          "error_params",
          "attempt_count"
        ],
        "title": "IngestJobItemSch",
        "type": "object"
      },
      "IngestJobLinksSch": {
        "description": "Related resources of a job.",
        "properties": {
          "items": {
            "title": "Items",
            "type": "string"
          },
          "self": {
            "title": "Self",
            "type": "string"
          }
        },
        "required": [
          "self",
          "items"
        ],
        "title": "IngestJobLinksSch",
        "type": "object"
      },
      "IngestJobOperationEnum": {
        "description": "What the job does to its entities.",
        "enum": [
          "create",
          "delete"
        ],
        "title": "IngestJobOperationEnum",
        "type": "string"
      },
      "IngestJobSch": {
        "description": "The resource a bulk request creates.",
        "properties": {
          "chunks_done": {
            "title": "Chunks Done",
            "type": "integer"
          },
          "chunks_total": {
            "title": "Chunks Total",
            "type": "integer"
          },
          "counts": {
            "$ref": "#/components/schemas/IngestJobCountsSch"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "entity_type": {
            "title": "Entity Type",
            "type": "string"
          },
          "finished_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "id": {
            "description": "Job id. Also the key of its `Location` header.",
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "links": {
            "$ref": "#/components/schemas/IngestJobLinksSch"
          },
          "operation": {
            "$ref": "#/components/schemas/IngestJobOperationEnum"
          },
          "source": {
            "$ref": "#/components/schemas/IngestJobSourceEnum"
          },
          "status": {
            "$ref": "#/components/schemas/IngestJobStatusEnum",
            "description": "`processing` while chunks are pending, then `completed` or `completed_with_errors`."
          }
        },
        "required": [
          "id",
          "status",
          "entity_type",
          "operation",
          "source",
          "counts",
          "chunks_total",
          "chunks_done",
          "created_at",
          "finished_at",
          "links"
        ],
        "title": "IngestJobSch",
        "type": "object"
      },
      "IngestJobSourceEnum": {
        "description": "Channel that submitted the job.",
        "enum": [
          "api_bulk",
          "file_upload",
          "import_wizard"
        ],
        "title": "IngestJobSourceEnum",
        "type": "string"
      },
      "IngestJobStatusEnum": {
        "description": "Lifecycle of an ingest job.",
        "enum": [
          "processing",
          "completed",
          "completed_with_errors",
          "failed"
        ],
        "title": "IngestJobStatusEnum",
        "type": "string"
      },
      "LegacyPageCustomized_IngestJobItemSch_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/IngestJobItemSch"
            },
            "title": "Items",
            "type": "array"
          },
          "page": {
            "minimum": 1.0,
            "title": "Page",
            "type": "integer"
          },
          "pages": {
            "title": "Pages",
            "type": "integer"
          },
          "size": {
            "minimum": 1.0,
            "title": "Size",
            "type": "integer"
          },
          "total": {
            "minimum": 0.0,
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "page",
          "size",
          "pages"
        ],
        "title": "LegacyPageCustomized[IngestJobItemSch]",
        "type": "object"
      },
      "LegacyPageCustomized_IngestJobSch_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/IngestJobSch"
            },
            "title": "Items",
            "type": "array"
          },
          "page": {
            "minimum": 1.0,
            "title": "Page",
            "type": "integer"
          },
          "pages": {
            "title": "Pages",
            "type": "integer"
          },
          "size": {
            "minimum": 1.0,
            "title": "Size",
            "type": "integer"
          },
          "total": {
            "minimum": 0.0,
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "page",
          "size",
          "pages"
        ],
        "title": "LegacyPageCustomized[IngestJobSch]",
        "type": "object"
      },
      "LegacyPageCustomized_WebhookDeliverySch_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/WebhookDeliverySch"
            },
            "title": "Items",
            "type": "array"
          },
          "page": {
            "minimum": 1.0,
            "title": "Page",
            "type": "integer"
          },
          "pages": {
            "title": "Pages",
            "type": "integer"
          },
          "size": {
            "minimum": 1.0,
            "title": "Size",
            "type": "integer"
          },
          "total": {
            "minimum": 0.0,
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "page",
          "size",
          "pages"
        ],
        "title": "LegacyPageCustomized[WebhookDeliverySch]",
        "type": "object"
      },
      "LegacyPageCustomized_WebhookEndpointSch_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/WebhookEndpointSch"
            },
            "title": "Items",
            "type": "array"
          },
          "page": {
            "minimum": 1.0,
            "title": "Page",
            "type": "integer"
          },
          "pages": {
            "title": "Pages",
            "type": "integer"
          },
          "size": {
            "minimum": 1.0,
            "title": "Size",
            "type": "integer"
          },
          "total": {
            "minimum": 0.0,
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "page",
          "size",
          "pages"
        ],
        "title": "LegacyPageCustomized[WebhookEndpointSch]",
        "type": "object"
      },
      "ValidationError": {
        "properties": {
          "ctx": {
            "title": "Context",
            "type": "object"
          },
          "input": {
            "title": "Input"
          },
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "title": "Location",
            "type": "array"
          },
          "msg": {
            "title": "Message",
            "type": "string"
          },
          "type": {
            "title": "Error Type",
            "type": "string"
          }
        },
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError",
        "type": "object"
      },
      "WasteBulkCreateSch": {
        "description": "Body of ``POST /v2/wastes``.\n\nRecords are validated one by one by the service, not here, so a 422 lists every invalid record with its index\nand a stable code, schema errors and business rules alike. ``SkipValidation`` keeps ``WasteBulkRecordSch`` as\nthe published item schema.",
        "properties": {
          "records": {
            "items": {
              "description": "One record of ``POST /v2/wastes``: the shared create fields plus a client correlation key.\n\nNo ``custom_emission_factor_id``: the legacy custom-EF pointer was never persisted by the API, and custom\nfactors come in through ``custom_ef_record_id``.",
              "properties": {
                "base_quantity": {
                  "description": "Waste quantity in the specified unit",
                  "exclusiveMinimum": 0.0,
                  "title": "Base Quantity",
                  "type": "number"
                },
                "client_row_id": {
                  "anyOf": [
                    {
                      "maxLength": 255,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Optional client key, echoed on every result for this record.",
                  "title": "Client Row Id"
                },
                "custom_ef_record_id": {
                  "anyOf": [
                    {
                      "format": "uuid",
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "UUID of a multidb custom emission-factor record (customEmissionFactorsMultiDb). Transient input: it is NOT stored on the waste row — it is persisted as a client_choice calculation config keyed on the waste (wastes activity category), which the calculation pipeline consumes.",
                  "title": "Custom Ef Record Id"
                },
                "description": {
                  "default": "",
                  "description": "Description of the waste",
                  "title": "Description",
                  "type": "string"
                },
                "destination": {
                  "default": "",
                  "description": "Waste destination or treatment facility",
                  "title": "Destination",
                  "type": "string"
                },
                "end_date": {
                  "description": "End date of the waste period",
                  "format": "date",
                  "title": "End Date",
                  "type": "string"
                },
                "facility_id": {
                  "description": "UUID of the facility this waste belongs to",
                  "format": "uuid",
                  "title": "Facility Id",
                  "type": "string"
                },
                "facility_percentages": {
                  "anyOf": [
                    {
                      "items": {
                        "$ref": "#/components/schemas/WasteFacilityPercentageSch"
                      },
                      "type": "array"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Optional split across facilities ('divide consumptions'). When more than one entry is given the waste is distributed: one row per facility sharing a source_waste_id, each with quantity = base_quantity x percentage. Percentages must sum to <= 1.",
                  "title": "Facility Percentages"
                },
                "file_url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "URL of an attached supporting document (e.g. waste manifest)",
                  "title": "File Url"
                },
                "identification_name": {
                  "description": "Waste identification name or invoice number",
                  "title": "Identification Name",
                  "type": "string"
                },
                "provider_name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Waste operator / gestor business name",
                  "title": "Provider Name"
                },
                "start_date": {
                  "description": "Start date of the waste period",
                  "format": "date",
                  "title": "Start Date",
                  "type": "string"
                },
                "total_km_to_waste_center": {
                  "default": 0,
                  "description": "Distance to waste center in km",
                  "minimum": 0.0,
                  "title": "Total Km To Waste Center",
                  "type": "number"
                },
                "transporter_name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Waste carrier / transportista business name",
                  "title": "Transporter Name"
                },
                "unit_id": {
                  "anyOf": [
                    {
                      "format": "uuid",
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "UUID of the quantity unit (defaults to kg)",
                  "title": "Unit Id"
                },
                "waste_ler_code_id": {
                  "anyOf": [
                    {
                      "format": "uuid",
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "UUID of the LER (European List of Waste) code from the kernel ``waste_ler_codes`` table. Used by the MultiDB path (``?multidb=true``). It may be omitted when a non-empty waste description will be matched to a MultiDB concept after creation; otherwise the pipeline resolves the emission factor from ``waste_matches`` keyed on (LER, R/D, source).",
                  "title": "Waste Ler Code Id"
                },
                "waste_rd_code_id": {
                  "anyOf": [
                    {
                      "format": "uuid",
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "UUID of the R/D (recovery/disposal) operation code from the kernel ``waste_rd_codes`` table. Optional (a third of records name no treatment).",
                  "title": "Waste Rd Code Id"
                }
              },
              "required": [
                "facility_id",
                "identification_name",
                "start_date",
                "end_date",
                "base_quantity"
              ],
              "title": "WasteBulkRecordSch",
              "type": "object"
            },
            "maxItems": 5000,
            "minItems": 1,
            "title": "Records",
            "type": "array"
          }
        },
        "required": [
          "records"
        ],
        "title": "WasteBulkCreateSch",
        "type": "object"
      },
      "WasteBulkDryRunSch": {
        "description": "Answer of ``POST /v2/wastes?dry_run=true`` when every record is valid. Nothing was written.",
        "properties": {
          "dry_run": {
            "default": true,
            "title": "Dry Run",
            "type": "boolean"
          },
          "submitted": {
            "description": "Records in the request.",
            "title": "Submitted",
            "type": "integer"
          },
          "valid": {
            "description": "Records that passed every check (all of them: an invalid one is a 422).",
            "title": "Valid",
            "type": "integer"
          }
        },
        "required": [
          "submitted",
          "valid"
        ],
        "title": "WasteBulkDryRunSch",
        "type": "object"
      },
      "WasteDeleteJobSch": {
        "description": "Body of ``POST /v2/wastes/delete``: the wastes to delete, by id.",
        "properties": {
          "ids": {
            "description": "Waste ids to delete, 1 to 5,000, each once.",
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "maxItems": 5000,
            "minItems": 1,
            "title": "Ids",
            "type": "array"
          }
        },
        "required": [
          "ids"
        ],
        "title": "WasteDeleteJobSch",
        "type": "object"
      },
      "WasteFacilityPercentageSch": {
        "description": "One facility's share of a distributed waste (\"divide consumptions\").\n\n``percentage`` is a fraction in (0, 1]. ``organization_id`` is accepted (the FE sends it) but the\nowning org is resolved server-side from each facility, mirroring the invoices split.",
        "properties": {
          "facility_id": {
            "description": "UUID of the facility receiving this share",
            "format": "uuid",
            "title": "Facility Id",
            "type": "string"
          },
          "organization_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Ignored server-side; resolved from the facility",
            "title": "Organization Id"
          },
          "percentage": {
            "description": "Fraction of the total quantity (0-1)",
            "exclusiveMinimum": 0.0,
            "maximum": 1.0,
            "title": "Percentage",
            "type": "number"
          }
        },
        "required": [
          "facility_id",
          "percentage"
        ],
        "title": "WasteFacilityPercentageSch",
        "type": "object"
      },
      "WebhookDeliverySch": {
        "description": "One event sent (or being sent) to an endpoint.",
        "properties": {
          "attempt_count": {
            "title": "Attempt Count",
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "delivered_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Delivered At"
          },
          "event_id": {
            "description": "Same value as the payload `id`; stable across retries.",
            "format": "uuid",
            "title": "Event Id",
            "type": "string"
          },
          "event_type": {
            "title": "Event Type",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "last_attempt_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Attempt At"
          },
          "last_duration_ms": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Duration Ms"
          },
          "last_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Error"
          },
          "last_status_code": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "HTTP status of the last attempt; `null` on network errors.",
            "title": "Last Status Code"
          },
          "next_attempt_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the next retry is due (UTC), while pending.",
            "title": "Next Attempt At"
          },
          "payload": {
            "additionalProperties": true,
            "description": "The exact JSON body that is sent.",
            "title": "Payload",
            "type": "object"
          },
          "status": {
            "$ref": "#/components/schemas/WebhookDeliveryStatusEnum"
          }
        },
        "required": [
          "id",
          "event_id",
          "event_type",
          "status",
          "attempt_count",
          "next_attempt_at",
          "last_attempt_at",
          "last_status_code",
          "last_error",
          "last_duration_ms",
          "delivered_at",
          "created_at",
          "payload"
        ],
        "title": "WebhookDeliverySch",
        "type": "object"
      },
      "WebhookDeliveryStatusEnum": {
        "description": "Outcome of one delivery: ``pending`` until a 2xx (``succeeded``) or the last retry fails (``failed``).",
        "enum": [
          "pending",
          "succeeded",
          "failed"
        ],
        "title": "WebhookDeliveryStatusEnum",
        "type": "string"
      },
      "WebhookEndpointCreateSch": {
        "description": "Body of ``POST /v2/webhook-endpoints``.",
        "properties": {
          "description": {
            "anyOf": [
              {
                "maxLength": 255,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Free text to recognize the endpoint.",
            "title": "Description"
          },
          "enabled": {
            "default": true,
            "description": "Disabled endpoints receive nothing.",
            "title": "Enabled",
            "type": "boolean"
          },
          "event_types": {
            "description": "Events delivered to this endpoint.",
            "examples": [
              [
                "ingest_job.finished"
              ]
            ],
            "items": {
              "$ref": "#/components/schemas/WebhookEventTypeEnum"
            },
            "minItems": 1,
            "title": "Event Types",
            "type": "array"
          },
          "url": {
            "description": "HTTPS URL that receives the events. Must resolve to a public address.",
            "examples": [
              "https://erp.example.com/dcycle/webhooks"
            ],
            "maxLength": 2048,
            "minLength": 9,
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url",
          "event_types"
        ],
        "title": "WebhookEndpointCreateSch",
        "type": "object"
      },
      "WebhookEndpointSch": {
        "description": "A webhook endpoint. The signing secret is only returned on creation and rotation.",
        "properties": {
          "consecutive_failures": {
            "description": "Deliveries in a row that exhausted their retries.",
            "title": "Consecutive Failures",
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "disabled_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`TOO_MANY_FAILURES` when Dcycle disabled the endpoint; `null` otherwise.",
            "title": "Disabled Reason"
          },
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          },
          "event_types": {
            "items": {
              "type": "string"
            },
            "title": "Event Types",
            "type": "array"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "id",
          "url",
          "description",
          "event_types",
          "enabled",
          "consecutive_failures",
          "disabled_reason",
          "created_at",
          "updated_at"
        ],
        "title": "WebhookEndpointSch",
        "type": "object"
      },
      "WebhookEndpointUpdateSch": {
        "description": "Body of ``PATCH /v2/webhook-endpoints/{endpoint_id}``. Omitted fields keep their value.",
        "properties": {
          "description": {
            "anyOf": [
              {
                "maxLength": 255,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Free text to recognize the endpoint.",
            "title": "Description"
          },
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "`true` re-enables an endpoint and resets its failure count.",
            "title": "Enabled"
          },
          "event_types": {
            "anyOf": [
              {
                "description": "Events delivered to this endpoint.",
                "examples": [
                  [
                    "ingest_job.finished"
                  ]
                ],
                "items": {
                  "$ref": "#/components/schemas/WebhookEventTypeEnum"
                },
                "minItems": 1,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Event Types"
          },
          "url": {
            "anyOf": [
              {
                "description": "HTTPS URL that receives the events. Must resolve to a public address.",
                "examples": [
                  "https://erp.example.com/dcycle/webhooks"
                ],
                "maxLength": 2048,
                "minLength": 9,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Url"
          }
        },
        "title": "WebhookEndpointUpdateSch",
        "type": "object"
      },
      "WebhookEndpointWithSecretSch": {
        "description": "A webhook endpoint with its signing secret. Store it: it is not shown again.",
        "properties": {
          "consecutive_failures": {
            "description": "Deliveries in a row that exhausted their retries.",
            "title": "Consecutive Failures",
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "disabled_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`TOO_MANY_FAILURES` when Dcycle disabled the endpoint; `null` otherwise.",
            "title": "Disabled Reason"
          },
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          },
          "event_types": {
            "items": {
              "type": "string"
            },
            "title": "Event Types",
            "type": "array"
          },
          "id": {
            "format": "uuid",
            "title": "Id",
            "type": "string"
          },
          "secret": {
            "description": "Signing secret (`whsec_…`). Verify `Dcycle-Signature` with it.",
            "title": "Secret",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "id",
          "url",
          "description",
          "event_types",
          "enabled",
          "consecutive_failures",
          "disabled_reason",
          "created_at",
          "updated_at",
          "secret"
        ],
        "title": "WebhookEndpointWithSecretSch",
        "type": "object"
      },
      "WebhookEventTypeEnum": {
        "description": "Events an endpoint can subscribe to. ``webhook.test`` is sent on demand only and needs no subscription.",
        "enum": [
          "ingest_job.finished",
          "webhook.test"
        ],
        "title": "WebhookEventTypeEnum",
        "type": "string"
      }
    },
    "securitySchemes": {
      "ApiKey": {
        "in": "header",
        "name": "x-api-key",
        "type": "apiKey"
      },
      "Organization": {
        "in": "header",
        "name": "x-organization-id",
        "type": "apiKey"
      }
    }
  },
  "info": {
    "description": "Bulk ingest, ingest jobs and webhooks. Guides: https://code.dcycle.io",
    "title": "Dcycle API v2 (BETA)",
    "version": "2"
  },
  "openapi": "3.1.0",
  "paths": {
    "/v2/ingest-jobs": {
      "get": {
        "description": "Jobs of the organization and its group, newest first: find a job whose id you no longer have.",
        "operationId": "list_ingest_jobs_v2_ingest_jobs_get",
        "parameters": [
          {
            "description": "Filter by job status",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/IngestJobStatusEnum"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by job status",
              "title": "Status"
            }
          },
          {
            "description": "Filter by what the job creates, e.g. `wastes`",
            "in": "query",
            "name": "entity_type",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by what the job creates, e.g. `wastes`",
              "title": "Entity Type"
            }
          },
          {
            "description": "Created at or after (ISO 8601, UTC)",
            "in": "query",
            "name": "created_from",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Created at or after (ISO 8601, UTC)",
              "title": "Created From"
            }
          },
          {
            "description": "Created before (ISO 8601, UTC)",
            "in": "query",
            "name": "created_to",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date-time",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Created before (ISO 8601, UTC)",
              "title": "Created To"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "default": 1,
              "minimum": 1,
              "title": "Page",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "size",
            "required": false,
            "schema": {
              "default": 10,
              "maximum": 500,
              "minimum": 1,
              "title": "Size",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-organization-id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "X-Organization-Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "schema": {
              "title": "X-Api-Key",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyPageCustomized_IngestJobSch_"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "summary": "List Ingest Jobs",
        "tags": [
          "ingest-jobs"
        ]
      }
    },
    "/v2/ingest-jobs/{job_id}": {
      "get": {
        "description": "Status and counters of a bulk job.",
        "operationId": "get_ingest_job_v2_ingest_jobs__job_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Job Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-organization-id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "X-Organization-Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "x-user-id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-User-Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestJobSch"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "summary": "Get Ingest Job",
        "tags": [
          "ingest-jobs"
        ]
      }
    },
    "/v2/ingest-jobs/{job_id}/items": {
      "get": {
        "description": "Per-record outcomes of a bulk job, in submission order.",
        "operationId": "get_ingest_job_items_v2_ingest_jobs__job_id__items_get",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Job Id",
              "type": "string"
            }
          },
          {
            "description": "Filter by outcome",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/IngestItemStatusEnum"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by outcome",
              "title": "Status"
            }
          },
          {
            "description": "Filter by stage",
            "in": "query",
            "name": "stage",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/IngestItemStageEnum"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by stage",
              "title": "Stage"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "default": 1,
              "minimum": 1,
              "title": "Page",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "size",
            "required": false,
            "schema": {
              "default": 10,
              "maximum": 500,
              "minimum": 1,
              "title": "Size",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-organization-id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "X-Organization-Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "x-user-id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-User-Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyPageCustomized_IngestJobItemSch_"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "summary": "Get Ingest Job Items",
        "tags": [
          "ingest-jobs"
        ]
      }
    },
    "/v2/wastes": {
      "post": {
        "description": "Create up to 5,000 wastes in one request (Bulk Ingest API).\n\nAll or nothing: if any record is invalid the answer is 422 `BULK_RECORDS_REJECTED`, listing every invalid record\nby `source_row_index`, and nothing is written. Otherwise the wastes are written at once and their emissions are\ncalculated asynchronously; the response is the job (`processing`), never the wastes themselves. Poll `Location`\n(`GET /v2/ingest-jobs/{id}`) for the calculation.",
        "operationId": "create_wastes_v2_v2_wastes_post",
        "parameters": [
          {
            "description": "Validate only: the same checks and 422, but nothing is written and no job is created.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "default": false,
              "description": "Validate only: the same checks and 422, but nothing is written and no job is created.",
              "title": "Dry Run",
              "type": "boolean"
            }
          },
          {
            "description": "Required. A unique value per batch: retrying with the same key and body returns the original job instead of creating the wastes again; the same key with another body is rejected.",
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "description": "Required. A unique value per batch: retrying with the same key and body returns the original job instead of creating the wastes again; the same key with another body is rejected.",
              "maxLength": 255,
              "minLength": 1,
              "title": "Idempotency-Key",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-organization-id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "X-Organization-Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "x-user-id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-User-Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WasteBulkCreateSch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WasteBulkDryRunSch"
                }
              }
            },
            "description": "`dry_run=true`: every record is valid; nothing was written."
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestJobSch"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "summary": "Create Wastes V2",
        "tags": [
          "Wastes"
        ]
      }
    },
    "/v2/wastes/delete": {
      "post": {
        "description": "Delete up to 5,000 wastes by id, asynchronously (Bulk Ingest API, ``operation=delete``).\n\nAll or nothing: an unknown, foreign or repeated id is a 422 ``BULK_RECORDS_REJECTED`` and nothing is deleted.\nOtherwise the answer is the job (`processing`); poll `Location` (`GET /v2/ingest-jobs/{id}`) or subscribe to\n`ingest_job.finished`. Deletion is permanent.",
        "operationId": "delete_wastes_v2_v2_wastes_delete_post",
        "parameters": [
          {
            "description": "Validate only: the same checks and 422, nothing is deleted.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "default": false,
              "description": "Validate only: the same checks and 422, nothing is deleted.",
              "title": "Dry Run",
              "type": "boolean"
            }
          },
          {
            "description": "Required. A unique value per batch: a retry with the same key and body returns the original job.",
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "description": "Required. A unique value per batch: a retry with the same key and body returns the original job.",
              "maxLength": 255,
              "minLength": 1,
              "title": "Idempotency-Key",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-organization-id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "X-Organization-Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "x-user-id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-User-Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WasteDeleteJobSch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WasteBulkDryRunSch"
                }
              }
            },
            "description": "`dry_run=true`: every id is valid."
          },
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestJobSch"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "summary": "Delete Wastes V2",
        "tags": [
          "Wastes"
        ]
      }
    },
    "/v2/webhook-endpoints": {
      "get": {
        "description": "Endpoints of the organization, newest first.",
        "operationId": "list_webhook_endpoints_v2_webhook_endpoints_get",
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "default": 1,
              "minimum": 1,
              "title": "Page",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "size",
            "required": false,
            "schema": {
              "default": 10,
              "maximum": 500,
              "minimum": 1,
              "title": "Size",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-organization-id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "X-Organization-Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "x-user-id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-User-Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyPageCustomized_WebhookEndpointSch_"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "summary": "List Webhook Endpoints",
        "tags": [
          "webhooks"
        ]
      },
      "post": {
        "description": "Register an endpoint. The response is the only time the signing secret is returned.",
        "operationId": "create_webhook_endpoint_v2_webhook_endpoints_post",
        "parameters": [
          {
            "in": "header",
            "name": "x-organization-id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "X-Organization-Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "x-user-id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-User-Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEndpointCreateSch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointWithSecretSch"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "summary": "Create Webhook Endpoint",
        "tags": [
          "webhooks"
        ]
      }
    },
    "/v2/webhook-endpoints/{endpoint_id}": {
      "delete": {
        "description": "Remove the endpoint and its delivery history. Pending retries are dropped.",
        "operationId": "delete_webhook_endpoint_v2_webhook_endpoints__endpoint_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "endpoint_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Endpoint Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-organization-id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "X-Organization-Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "x-user-id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-User-Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "summary": "Delete Webhook Endpoint",
        "tags": [
          "webhooks"
        ]
      },
      "get": {
        "description": "One endpoint.",
        "operationId": "get_webhook_endpoint_v2_webhook_endpoints__endpoint_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "endpoint_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Endpoint Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-organization-id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "X-Organization-Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "x-user-id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-User-Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointSch"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "summary": "Get Webhook Endpoint",
        "tags": [
          "webhooks"
        ]
      },
      "patch": {
        "description": "Change the URL, events, description or `enabled`. Re-enabling resets the failure count.",
        "operationId": "update_webhook_endpoint_v2_webhook_endpoints__endpoint_id__patch",
        "parameters": [
          {
            "in": "path",
            "name": "endpoint_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Endpoint Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-organization-id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "X-Organization-Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "x-user-id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-User-Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEndpointUpdateSch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointSch"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "summary": "Update Webhook Endpoint",
        "tags": [
          "webhooks"
        ]
      }
    },
    "/v2/webhook-endpoints/{endpoint_id}/deliveries": {
      "get": {
        "description": "Deliveries sent to the endpoint, newest first, with the outcome of their last attempt.",
        "operationId": "list_webhook_deliveries_v2_webhook_endpoints__endpoint_id__deliveries_get",
        "parameters": [
          {
            "in": "path",
            "name": "endpoint_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Endpoint Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "default": 1,
              "minimum": 1,
              "title": "Page",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "size",
            "required": false,
            "schema": {
              "default": 10,
              "maximum": 500,
              "minimum": 1,
              "title": "Size",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "x-organization-id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "X-Organization-Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "x-user-id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-User-Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyPageCustomized_WebhookDeliverySch_"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "summary": "List Webhook Deliveries",
        "tags": [
          "webhooks"
        ]
      }
    },
    "/v2/webhook-endpoints/{endpoint_id}/deliveries/{delivery_id}/retry": {
      "post": {
        "description": "Send a past delivery's event again, now (one attempt, no retries), and return the new delivery.",
        "operationId": "retry_webhook_delivery_v2_webhook_endpoints__endpoint_id__deliveries__delivery_id__retry_post",
        "parameters": [
          {
            "in": "path",
            "name": "delivery_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Delivery Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "endpoint_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Endpoint Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-organization-id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "X-Organization-Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "x-user-id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-User-Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliverySch"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "summary": "Retry Webhook Delivery",
        "tags": [
          "webhooks"
        ]
      }
    },
    "/v2/webhook-endpoints/{endpoint_id}/rotate-secret": {
      "post": {
        "description": "Replace the signing secret. The old one stops working at once.",
        "operationId": "rotate_webhook_endpoint_secret_v2_webhook_endpoints__endpoint_id__rotate_secret_post",
        "parameters": [
          {
            "in": "path",
            "name": "endpoint_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Endpoint Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-organization-id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "X-Organization-Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "x-user-id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-User-Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointWithSecretSch"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "summary": "Rotate Webhook Endpoint Secret",
        "tags": [
          "webhooks"
        ]
      }
    },
    "/v2/webhook-endpoints/{endpoint_id}/test": {
      "post": {
        "description": "Send a signed `webhook.test` event now (one attempt, no retries) and return how it went.",
        "operationId": "test_webhook_endpoint_v2_webhook_endpoints__endpoint_id__test_post",
        "parameters": [
          {
            "in": "path",
            "name": "endpoint_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "Endpoint Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-organization-id",
            "required": true,
            "schema": {
              "format": "uuid",
              "title": "X-Organization-Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "x-user-id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-User-Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliverySch"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "summary": "Test Webhook Endpoint",
        "tags": [
          "webhooks"
        ]
      }
    }
  },
  "security": [
    {
      "ApiKey": [],
      "Organization": []
    }
  ],
  "servers": [
    {
      "url": "https://api.dcycle.io"
    }
  ]
}
