{
  "openapi": "3.1.0",
  "info": {
    "title": "Zwely API",
    "version": "1.0.0",
    "description": "Private, workspace-scoped submission collection API. Integer bytes use decimal GB. 120 requests/minute per token."
  },
  "servers": [
    {
      "url": "/api/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "paths": {
    "/workspace": {
      "get": {
        "tags": [
          "Workspace"
        ],
        "summary": "Retrieve the workspace",
        "description": "Use this endpoint to confirm which workspace a token can access and see its current plan.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "uuid": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        },
                        "plan": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": 1,
                    "uuid": "462abdd3-2fac-4dc7-a0ed-2c19146f1854",
                    "name": "Example Studio",
                    "plan": "professional"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/storage": {
      "get": {
        "tags": [
          "Workspace"
        ],
        "summary": "Retrieve storage usage",
        "description": "Check the workspace quota, stored bytes, and capacity reserved for uploads. All sizes are measured in bytes.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "quota_bytes": {
                          "type": "integer"
                        },
                        "used_bytes": {
                          "type": "integer"
                        },
                        "physical_bytes": {
                          "type": "integer"
                        },
                        "reserved_bytes": {
                          "type": "integer"
                        },
                        "available_bytes": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "quota_bytes": 250000000000,
                    "used_bytes": 82400,
                    "physical_bytes": 82400,
                    "reserved_bytes": 0,
                    "available_bytes": 249999917600
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/reports": {
      "get": {
        "tags": [
          "Workspace"
        ],
        "summary": "Retrieve reports",
        "description": "Get the number of submissions, totals by status, and completed evaluations for the workspace.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "submissions": {
                          "type": "integer"
                        },
                        "by_status": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "status": {
                                "type": "string"
                              },
                              "total": {
                                "type": "integer"
                              }
                            }
                          }
                        },
                        "scores": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "integer"
                              },
                              "submission_id": {
                                "type": "integer"
                              },
                              "rubric_version_id": {
                                "type": "integer"
                              },
                              "scores": {
                                "type": "object",
                                "properties": {
                                  "craft": {
                                    "type": "integer"
                                  }
                                }
                              },
                              "total": {
                                "type": "integer"
                              },
                              "completed_at": {
                                "type": "string",
                                "format": "date-time"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "submissions": 1,
                    "by_status": [
                      {
                        "status": "new",
                        "total": 1
                      }
                    ],
                    "scores": [
                      {
                        "id": 64,
                        "submission_id": 27,
                        "rubric_version_id": 42,
                        "scores": {
                          "craft": 8
                        },
                        "total": 80,
                        "completed_at": "2026-12-01T12:00:00Z"
                      }
                    ]
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/campaigns": {
      "get": {
        "tags": [
          "Campaigns"
        ],
        "summary": "List campaigns",
        "description": "Retrieve campaigns for the token’s workspace, 25 per page.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Page number. The first page is 1."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "current_page": {
                          "type": "integer"
                        },
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "integer"
                              },
                              "uuid": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "name": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "slug": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "per_page": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "current_page": 1,
                    "data": [
                      {
                        "id": 8,
                        "uuid": "2fb99ad3-34ca-4d6f-b071-b050f0f11210",
                        "name": "Portfolio applications",
                        "type": "portfolio",
                        "slug": "portfolio-applications-example",
                        "status": "draft"
                      }
                    ],
                    "per_page": 25,
                    "total": 1
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      },
      "post": {
        "tags": [
          "Campaigns"
        ],
        "summary": "Create a draft campaign",
        "description": "Start from a template and get the campaign UUID for future requests. Publish the draft when its questions and upload fields are ready.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 150,
                    "description": "Campaign name."
                  },
                  "type": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "audio",
                      "photography",
                      "film",
                      "manuscript",
                      "portfolio",
                      "general",
                      "stems",
                      "casting",
                      null
                    ],
                    "description": "Template key. Defaults to general."
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 5000,
                    "description": "Message displayed to submitters."
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "Portfolio applications",
                "type": "portfolio"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "uuid": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": 8,
                    "uuid": "2fb99ad3-34ca-4d6f-b071-b050f0f11210",
                    "name": "Portfolio applications",
                    "type": "portfolio",
                    "slug": "portfolio-applications-example"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/campaigns/{campaign}": {
      "get": {
        "tags": [
          "Campaigns"
        ],
        "summary": "Retrieve a campaign",
        "description": "Use the campaign UUID to retrieve its settings and current draft schema.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Campaign UUID.",
            "example": "2fb99ad3-34ca-4d6f-b071-b050f0f11210"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "uuid": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": 8,
                    "uuid": "2fb99ad3-34ca-4d6f-b071-b050f0f11210",
                    "name": "Portfolio applications",
                    "type": "portfolio",
                    "slug": "portfolio-applications-example",
                    "status": "draft"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      },
      "patch": {
        "tags": [
          "Campaigns"
        ],
        "summary": "Update a draft campaign",
        "description": "Update the title, welcome message, or draft fields. A supplied schema replaces the draft fields. Publish to make the changes available to submitters.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Campaign UUID.",
            "example": "2fb99ad3-34ca-4d6f-b071-b050f0f11210"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 150,
                    "description": "Campaign name."
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 5000,
                    "description": "Message displayed to submitters."
                  },
                  "schema": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "id",
                        "type",
                        "label"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        },
                        "required": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "name": "Portfolio call"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "uuid": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": 8,
                    "uuid": "2fb99ad3-34ca-4d6f-b071-b050f0f11210",
                    "name": "Portfolio call",
                    "type": "portfolio",
                    "slug": "portfolio-applications-example",
                    "status": "draft"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      },
      "delete": {
        "tags": [
          "Campaigns"
        ],
        "summary": "Delete a campaign",
        "description": "Schedule permanent campaign deletion. Send the exact campaign name as confirmation. The cleanup worker removes files asynchronously.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Campaign UUID.",
            "example": "2fb99ad3-34ca-4d6f-b071-b050f0f11210"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "confirmation": {
                    "type": "string",
                    "description": "Exact campaign name."
                  }
                },
                "required": [
                  "confirmation"
                ]
              },
              "example": {
                "confirmation": "Portfolio applications"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "status": "deleting"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/submissions": {
      "get": {
        "tags": [
          "Submissions"
        ],
        "summary": "List submissions",
        "description": "Retrieve submissions newest first, 25 per page. Filter by a campaign UUID, a status, or both.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "UUID of the campaign to filter by."
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Submission status key."
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Page number. The first page is 1."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "current_page": {
                          "type": "integer"
                        },
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "integer"
                              },
                              "uuid": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "reference": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "answers": {
                                "type": "object",
                                "properties": {
                                  "title": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          }
                        },
                        "per_page": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "current_page": 1,
                    "data": [
                      {
                        "id": 27,
                        "uuid": "47e8d963-7554-4e54-8480-acbcc3fd1319",
                        "reference": "ZW-EXAMPLE",
                        "title": "Light study",
                        "status": "new",
                        "answers": {
                          "title": "Light study"
                        }
                      }
                    ],
                    "per_page": 25,
                    "total": 1
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/submissions/{submission}": {
      "get": {
        "tags": [
          "Submissions"
        ],
        "summary": "Retrieve a submission",
        "description": "Use its UUID to retrieve a submission and its answers. Visibility depends on the token owner’s access.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "submission",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Submission UUID.",
            "example": "47e8d963-7554-4e54-8480-acbcc3fd1319"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "uuid": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "reference": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "answers": {
                          "type": "object",
                          "properties": {
                            "title": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": 27,
                    "uuid": "47e8d963-7554-4e54-8480-acbcc3fd1319",
                    "reference": "ZW-EXAMPLE",
                    "title": "Light study",
                    "status": "new",
                    "answers": {
                      "title": "Light study"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      },
      "delete": {
        "tags": [
          "Submissions"
        ],
        "summary": "Delete a submission",
        "description": "Confirm permanent deletion. File cleanup runs asynchronously and historical monthly usage is retained.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "submission",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Submission UUID.",
            "example": "47e8d963-7554-4e54-8480-acbcc3fd1319"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "confirm": {
                    "type": "boolean",
                    "description": "Set to true to authorize permanent removal."
                  }
                },
                "required": [
                  "confirm"
                ]
              },
              "example": {
                "confirm": true
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No content"
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/uploads/{upload}": {
      "get": {
        "tags": [
          "Uploads"
        ],
        "summary": "Retrieve upload status",
        "description": "Check whether a reserved upload is ready to attach to a submission. During direct upload verification, poll this endpoint until the state is completed or canceled.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "upload",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Upload session UUID.",
            "example": "39fd3ffd-1fd4-4ac7-9395-6497c219df8e"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "object_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "state": {
                          "type": "string"
                        },
                        "expires_at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "error": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "39fd3ffd-1fd4-4ac7-9395-6497c219df8e",
                    "object_id": "1c0ab573-496d-4375-892f-de0d650bc133",
                    "state": "completed",
                    "expires_at": "2026-12-01T12:30:00Z",
                    "error": null
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      },
      "delete": {
        "tags": [
          "Uploads"
        ],
        "summary": "Cancel an upload",
        "description": "Cancel an upload session and release its reserved capacity.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "upload",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Upload session UUID.",
            "example": "39fd3ffd-1fd4-4ac7-9395-6497c219df8e"
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/files/{object}": {
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "Retrieve file metadata",
        "description": "Read the original filename, content type, and size. Use the content endpoint for the bytes.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "object",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Stored file object UUID.",
            "example": "1c0ab573-496d-4375-892f-de0d650bc133"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        },
                        "mime": {
                          "type": "string"
                        },
                        "size": {
                          "type": "integer"
                        },
                        "state": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "1c0ab573-496d-4375-892f-de0d650bc133",
                    "name": "portfolio.pdf",
                    "mime": "application/pdf",
                    "size": 82400,
                    "state": "ready"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      },
      "delete": {
        "tags": [
          "Files"
        ],
        "summary": "Delete a submitted file",
        "description": "Remove the file’s submission reference and schedule cleanup. Send confirm set to true.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "object",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Stored file object UUID.",
            "example": "1c0ab573-496d-4375-892f-de0d650bc133"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "confirm": {
                    "type": "boolean",
                    "description": "Set to true to authorize permanent removal."
                  }
                },
                "required": [
                  "confirm"
                ]
              },
              "example": {
                "confirm": true
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No content"
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/campaigns/{campaign}/rubrics": {
      "get": {
        "tags": [
          "Review"
        ],
        "summary": "List rubric versions",
        "description": "Retrieve the campaign’s immutable scorecards across judging rounds.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Campaign UUID.",
            "example": "2fb99ad3-34ca-4d6f-b071-b050f0f11210"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "campaign_id": {
                            "type": "integer"
                          },
                          "round": {
                            "type": "integer"
                          },
                          "criteria": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "min": {
                                  "type": "integer"
                                },
                                "max": {
                                  "type": "integer"
                                },
                                "weight": {
                                  "type": "integer"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": 42,
                      "campaign_id": 8,
                      "round": 1,
                      "criteria": [
                        {
                          "id": "craft",
                          "name": "Craft",
                          "min": 0,
                          "max": 10,
                          "weight": 1
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      },
      "post": {
        "tags": [
          "Review"
        ],
        "summary": "Create a rubric version",
        "description": "Save a new immutable scorecard for the selected round. Each criterion defines a numeric range and a relative weight.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Campaign UUID.",
            "example": "2fb99ad3-34ca-4d6f-b071-b050f0f11210"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "round": {
                    "type": "integer"
                  },
                  "criteria": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "min": {
                          "type": "number"
                        },
                        "max": {
                          "type": "number"
                        },
                        "weight": {
                          "type": "number"
                        },
                        "description": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "required": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "min",
                        "max",
                        "weight"
                      ]
                    }
                  }
                },
                "required": [
                  "round",
                  "criteria"
                ]
              },
              "example": {
                "round": 1,
                "criteria": [
                  {
                    "id": "craft",
                    "name": "Craft",
                    "min": 0,
                    "max": 10,
                    "weight": 1
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "campaign_id": {
                          "type": "integer"
                        },
                        "round": {
                          "type": "integer"
                        },
                        "criteria": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "min": {
                                "type": "integer"
                              },
                              "max": {
                                "type": "integer"
                              },
                              "weight": {
                                "type": "integer"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": 42,
                    "campaign_id": 8,
                    "round": 1,
                    "criteria": [
                      {
                        "id": "craft",
                        "name": "Craft",
                        "min": 0,
                        "max": 10,
                        "weight": 1
                      }
                    ]
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhook endpoints",
        "description": "Retrieve the webhook destinations configured for the workspace.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "url": {
                            "type": "string"
                          },
                          "events": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": 4,
                      "url": "https://example.com/webhooks/zwely",
                      "events": [
                        "submission.created"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      },
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Create a webhook endpoint",
        "description": "Register an HTTPS endpoint and subscribe it to events. Save the signing secret returned at creation for verifying incoming deliveries.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Event names to deliver to this webhook."
                  }
                },
                "required": [
                  "url",
                  "events"
                ]
              },
              "example": {
                "url": "https://example.com/webhooks/zwely",
                "events": [
                  "submission.created"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "url": {
                          "type": "string"
                        },
                        "events": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "secret": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": 4,
                    "url": "https://example.com/webhooks/zwely",
                    "events": [
                      "submission.created"
                    ]
                  },
                  "secret": "example_signing_secret"
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/campaigns/{campaign}/publish": {
      "post": {
        "tags": [
          "Campaigns"
        ],
        "summary": "Publish a campaign",
        "description": "Publish the current draft so the form can accept submissions with its configured access and scheduling settings.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Campaign UUID.",
            "example": "2fb99ad3-34ca-4d6f-b071-b050f0f11210"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "uuid": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": 8,
                    "uuid": "2fb99ad3-34ca-4d6f-b071-b050f0f11210",
                    "name": "Portfolio applications",
                    "type": "portfolio",
                    "slug": "portfolio-applications-example",
                    "status": "published"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/campaigns/{campaign}/archive": {
      "post": {
        "tags": [
          "Campaigns"
        ],
        "summary": "Archive a campaign",
        "description": "Archive the campaign and stop accepting new submissions. Existing entries remain available.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Campaign UUID.",
            "example": "2fb99ad3-34ca-4d6f-b071-b050f0f11210"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "uuid": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": 8,
                    "uuid": "2fb99ad3-34ca-4d6f-b071-b050f0f11210",
                    "name": "Portfolio applications",
                    "type": "portfolio",
                    "slug": "portfolio-applications-example",
                    "status": "archived"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/campaigns/{campaign}/uploads": {
      "post": {
        "tags": [
          "Uploads"
        ],
        "summary": "Reserve an upload",
        "description": "Reserve the file’s exact byte count for a published upload field. Reuse the draft UUID for each file that belongs to the same submission.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Campaign UUID.",
            "example": "2fb99ad3-34ca-4d6f-b071-b050f0f11210"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "draft": {
                    "type": "string",
                    "format": "uuid",
                    "description": "UUID shared by this submission and its upload sessions."
                  },
                  "field_id": {
                    "type": "string",
                    "description": "Stable ID of the published upload field."
                  },
                  "bytes": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Exact size of the file in bytes."
                  }
                },
                "required": [
                  "draft",
                  "field_id",
                  "bytes"
                ]
              },
              "example": {
                "draft": "0e2718d0-b332-4b05-98b9-40de5b183f8c",
                "field_id": "work",
                "bytes": 82400
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "object_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "state": {
                          "type": "string"
                        },
                        "expires_at": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "39fd3ffd-1fd4-4ac7-9395-6497c219df8e",
                    "object_id": "1c0ab573-496d-4375-892f-de0d650bc133",
                    "state": "reserved",
                    "expires_at": "2026-12-01T12:30:00Z"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/uploads/{upload}/complete": {
      "post": {
        "tags": [
          "Uploads"
        ],
        "summary": "Upload a file",
        "description": "Send the complete file as multipart form data. The server verifies the contents and size against the field’s upload rules.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "upload",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Upload session UUID.",
            "example": "39fd3ffd-1fd4-4ac7-9395-6497c219df8e"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "File data sent as multipart form data."
                  }
                }
              },
              "example": {
                "file": "portfolio.pdf"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        },
                        "mime": {
                          "type": "string"
                        },
                        "size": {
                          "type": "integer"
                        },
                        "state": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "1c0ab573-496d-4375-892f-de0d650bc133",
                    "name": "portfolio.pdf",
                    "mime": "application/pdf",
                    "size": 82400,
                    "state": "ready"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/campaigns/{campaign}/submissions": {
      "post": {
        "tags": [
          "Submissions"
        ],
        "summary": "Create a submission",
        "description": "Send answers keyed by the published field IDs. Attach completed file object IDs from the same draft. Retry the same request with the same UUID Idempotency-Key.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Campaign UUID.",
            "example": "2fb99ad3-34ca-4d6f-b071-b050f0f11210"
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "A UUID unique to this logical submission. Reuse it when retrying.",
            "example": "a6b07750-20aa-47ee-ba07-6670fef8199d"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "answers": {
                    "type": "object",
                    "description": "Answers keyed by published field ID."
                  },
                  "objects": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "description": "IDs of verified uploaded file objects."
                  },
                  "draft": {
                    "type": "string",
                    "format": "uuid",
                    "description": "UUID shared by this submission and its upload sessions."
                  }
                },
                "required": [
                  "answers",
                  "draft"
                ]
              },
              "example": {
                "answers": {
                  "name": "Sample Artist",
                  "email": "artist@example.com",
                  "title": "Light study"
                },
                "objects": [
                  "1c0ab573-496d-4375-892f-de0d650bc133"
                ],
                "draft": "0e2718d0-b332-4b05-98b9-40de5b183f8c"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "uuid": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "reference": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "answers": {
                          "type": "object",
                          "properties": {
                            "title": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": 27,
                    "uuid": "47e8d963-7554-4e54-8480-acbcc3fd1319",
                    "reference": "ZW-EXAMPLE",
                    "title": "Light study",
                    "status": "new",
                    "answers": {
                      "title": "Light study"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/submissions/{submission}/status": {
      "patch": {
        "tags": [
          "Submissions"
        ],
        "summary": "Update a submission’s status",
        "description": "Choose a status that exists in the submission’s campaign workflow.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "submission",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Submission UUID.",
            "example": "47e8d963-7554-4e54-8480-acbcc3fd1319"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "description": "A status key configured in the campaign workflow."
                  }
                },
                "required": [
                  "status"
                ]
              },
              "example": {
                "status": "in_review"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "uuid": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "reference": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "answers": {
                          "type": "object",
                          "properties": {
                            "title": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": 27,
                    "uuid": "47e8d963-7554-4e54-8480-acbcc3fd1319",
                    "reference": "ZW-EXAMPLE",
                    "title": "Light study",
                    "status": "in_review",
                    "answers": {
                      "title": "Light study"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/campaigns/{campaign}/assignments": {
      "post": {
        "tags": [
          "Review"
        ],
        "summary": "Assign a reviewer",
        "description": "Assign a reviewer who has access to the campaign. Use numeric user and submission IDs in the request body.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Campaign UUID.",
            "example": "2fb99ad3-34ca-4d6f-b071-b050f0f11210"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "user_id": {
                    "type": "integer"
                  },
                  "submission_id": {
                    "type": "integer"
                  },
                  "round": {
                    "type": "integer"
                  },
                  "due_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time",
                    "description": "Optional review deadline."
                  }
                },
                "required": [
                  "user_id",
                  "submission_id",
                  "round"
                ]
              },
              "example": {
                "user_id": 7,
                "submission_id": 27,
                "round": 1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "assigned": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "assigned": true
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/submissions/{submission}/evaluations": {
      "post": {
        "tags": [
          "Review"
        ],
        "summary": "Save an evaluation",
        "description": "Send scores keyed by criterion ID. Set complete to true to submit the evaluation, or leave it false to save a draft.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "submission",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Submission UUID.",
            "example": "47e8d963-7554-4e54-8480-acbcc3fd1319"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rubric_version_id": {
                    "type": "integer",
                    "description": "Numeric ID of the immutable rubric version."
                  },
                  "scores": {
                    "type": "object",
                    "description": "Numeric scores keyed by criterion ID.",
                    "additionalProperties": {
                      "type": "number"
                    }
                  },
                  "complete": {
                    "type": "boolean",
                    "description": "Set to true to submit the evaluation."
                  },
                  "feedback": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 10000
                  }
                },
                "required": [
                  "rubric_version_id",
                  "scores"
                ]
              },
              "example": {
                "rubric_version_id": 42,
                "scores": {
                  "craft": 8
                },
                "complete": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "submission_id": {
                          "type": "integer"
                        },
                        "rubric_version_id": {
                          "type": "integer"
                        },
                        "scores": {
                          "type": "object",
                          "properties": {
                            "craft": {
                              "type": "integer"
                            }
                          }
                        },
                        "total": {
                          "type": "integer"
                        },
                        "completed_at": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": 64,
                    "submission_id": 27,
                    "rubric_version_id": 42,
                    "scores": {
                      "craft": 8
                    },
                    "total": 80,
                    "completed_at": "2026-12-01T12:00:00Z"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "tags": [
          "MCP"
        ],
        "summary": "Connect through MCP",
        "description": "Send JSON-RPC 2.0 requests to Zwely’s stateless MCP endpoint. Use initialize to discover capabilities and tools/list to discover available tools. The token needs the scope required by the requested method or tool.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "jsonrpc": {
                    "type": "string",
                    "enum": [
                      "2.0"
                    ]
                  },
                  "id": {},
                  "method": {
                    "type": "string"
                  },
                  "params": {
                    "type": "object"
                  }
                },
                "required": [
                  "jsonrpc",
                  "method"
                ]
              },
              "example": {
                "jsonrpc": "2.0",
                "id": 1,
                "method": "initialize"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jsonrpc": {
                      "type": "string"
                    },
                    "id": {
                      "type": [
                        "integer",
                        "number",
                        "string",
                        "null"
                      ]
                    },
                    "result": {
                      "type": "object",
                      "properties": {
                        "protocolVersion": {
                          "type": "string"
                        },
                        "capabilities": {
                          "type": "object",
                          "properties": {
                            "tools": {
                              "type": "object",
                              "properties": {}
                            }
                          }
                        },
                        "serverInfo": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "version": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "integer"
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "jsonrpc": "2.0",
                  "id": 1,
                  "result": {
                    "protocolVersion": "2025-03-26",
                    "capabilities": {
                      "tools": {}
                    },
                    "serverInfo": {
                      "name": "zwely",
                      "version": "1.0.0"
                    }
                  }
                }
              }
            }
          },
          "202": {
            "description": "Notification received. No JSON body is returned."
          },
          "401": {
            "description": "Invalid token"
          },
          "403": {
            "description": "Permission or plan denied"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/uploads/{upload}/chunks/{index}": {
      "post": {
        "tags": [
          "Uploads"
        ],
        "summary": "Upload a chunk",
        "description": "Send one chunk of up to 10 MB as multipart form data. Chunk indexes start at zero. Retry the same index with the same bytes to resume.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "upload",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Upload session UUID.",
            "example": "39fd3ffd-1fd4-4ac7-9395-6497c219df8e"
          },
          {
            "name": "index",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 0
            },
            "description": "Zero-based chunk index.",
            "example": 0
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "File data sent as multipart form data."
                  }
                }
              },
              "example": {
                "file": "chunk-0.bin"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "size": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "1c0ab573-496d-4375-892f-de0d650bc133",
                    "size": 82400
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or expired API token"
          },
          "403": {
            "description": "Permission, scope, or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Invalid chunk, expired session or capacity exceeded"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/uploads/{upload}/assemble": {
      "post": {
        "tags": [
          "Uploads"
        ],
        "summary": "Assemble uploaded chunks",
        "description": "Supply the original filename and number of chunks. Zwely assembles the chunks in order and verifies the complete file.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "upload",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Upload session UUID.",
            "example": "39fd3ffd-1fd4-4ac7-9395-6497c219df8e"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "chunks"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Original filename."
                  },
                  "chunks": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  }
                }
              },
              "example": {
                "name": "portfolio.pdf",
                "chunks": 1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "name": {
                          "type": "string"
                        },
                        "mime": {
                          "type": "string"
                        },
                        "size": {
                          "type": "integer"
                        },
                        "state": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "1c0ab573-496d-4375-892f-de0d650bc133",
                    "name": "portfolio.pdf",
                    "mime": "application/pdf",
                    "size": 82400,
                    "state": "ready"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or expired API token"
          },
          "403": {
            "description": "Permission, scope, or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Missing or invalid chunks/media"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/uploads/{upload}/direct": {
      "post": {
        "tags": [
          "Uploads"
        ],
        "summary": "Start a direct upload",
        "description": "Reserve the exact byte count first. Split the file into parts of data.part_bytes bytes (the last part may be smaller). Skip the 1-based numbers in data.uploaded. For each item in data.parts, PUT its raw slice to the supplied URL with the exact Content-Length and without a Zwely Authorization header. When data.state is verifying, poll the upload status instead of sending more parts.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "upload",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Upload session UUID.",
            "example": "39fd3ffd-1fd4-4ac7-9395-6497c219df8e"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string"
                        },
                        "part_bytes": {
                          "type": "integer"
                        },
                        "uploaded": {
                          "type": "array",
                          "items": {
                            "type": "integer"
                          }
                        },
                        "parts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "number": {
                                "type": "integer"
                              },
                              "url": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "state": "reserved",
                    "part_bytes": 10485760,
                    "uploaded": [
                      1
                    ],
                    "parts": [
                      {
                        "number": 2,
                        "url": "https://storage.example.com/signed-part-url"
                      }
                    ]
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or expired API token"
          },
          "403": {
            "description": "Permission, scope, or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Upload expired, form changed or disk does not support direct uploads"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/uploads/{upload}/direct/complete": {
      "post": {
        "tags": [
          "Uploads"
        ],
        "summary": "Complete a direct upload",
        "description": "Poll GET /uploads/{upload} until data.state is completed before attaching data.object_id to a submission. If the file was rejected, the state is canceled and data.error describes the problem.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "upload",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Upload session UUID.",
            "example": "39fd3ffd-1fd4-4ac7-9395-6497c219df8e"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Original filename."
                  }
                }
              },
              "example": {
                "name": "portfolio.pdf"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string"
                        },
                        "object_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "expires_at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "error": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "state": "verifying",
                    "object_id": "1c0ab573-496d-4375-892f-de0d650bc133",
                    "expires_at": "2026-12-01T12:30:00Z",
                    "error": null
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or expired API token"
          },
          "403": {
            "description": "Permission, scope, or plan denied"
          },
          "404": {
            "description": "Resource not found"
          },
          "422": {
            "description": "Parts are missing, upload expired or form changed"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/files/{object}/content": {
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "Download file content",
        "description": "Retrieve the private file. Local storage supports byte ranges. For files served through a temporary storage URL, follow the redirect without forwarding the Zwely token.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "object",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Stored file object UUID.",
            "example": "1c0ab573-496d-4375-892f-de0d650bc133"
          },
          {
            "name": "download",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "Serve the file as an attachment."
          },
          {
            "name": "Range",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Request a byte range from local storage."
          }
        ],
        "responses": {
          "200": {
            "description": "Complete file stream"
          },
          "206": {
            "description": "Partial content from local storage"
          },
          "302": {
            "description": "Redirect to the file’s temporary storage URL"
          },
          "401": {
            "description": "Invalid or expired API token"
          },
          "403": {
            "description": "Resource not authorized"
          },
          "404": {
            "description": "Not available"
          },
          "416": {
            "description": "Requested byte range unavailable"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/question-types": {
      "get": {
        "tags": [
          "Questions"
        ],
        "summary": "List question types and defaults",
        "description": "Discover the supported field types, grouped as they appear in the form builder. The defaults returned reflect this installation. Choice questions need at least two options.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "description": "Supported question type key from GET /question-types."
                          },
                          "label": {
                            "type": "string",
                            "description": "Display name."
                          },
                          "group": {
                            "type": "string",
                            "description": "Category used by the question builder."
                          },
                          "defaults": {
                            "type": "object",
                            "description": "Default properties for new questions of this type."
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "type": "text",
                      "label": "Short text",
                      "group": "Writing & links",
                      "defaults": {
                        "required": false,
                        "max_length": 10000
                      }
                    },
                    {
                      "type": "rating",
                      "label": "Rating",
                      "group": "Choices",
                      "defaults": {
                        "required": false,
                        "min": 1,
                        "max": 5
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or expired API token"
          },
          "403": {
            "description": "Permission, scope, or plan denied"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/campaigns/{campaign}/questions": {
      "get": {
        "tags": [
          "Questions"
        ],
        "summary": "List draft questions",
        "description": "Get the questions and display fields in the order they appear in the campaign’s draft form.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "description": "Campaign UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "2fb99ad3-34ca-4d6f-b071-b050f0f11210"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Stable ID. Letters, digits, hyphens, and underscores. Omit when creating to generate one.",
                            "maxLength": 80
                          },
                          "type": {
                            "type": "string",
                            "description": "Supported question type key from GET /question-types."
                          },
                          "label": {
                            "type": "string",
                            "description": "Question wording or the text of a display field.",
                            "maxLength": 250
                          },
                          "required": {
                            "type": "boolean",
                            "description": "Whether a submitter must answer the question."
                          },
                          "min": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Lowest allowed number or rating."
                          },
                          "max": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Highest allowed number or rating."
                          }
                        },
                        "required": [
                          "id",
                          "type",
                          "label"
                        ]
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "title",
                      "type": "text",
                      "label": "Portfolio title",
                      "required": true
                    },
                    {
                      "id": "portfolio_rating",
                      "type": "rating",
                      "label": "How ready is your portfolio?",
                      "required": false,
                      "min": 1,
                      "max": 5
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or expired API token"
          },
          "403": {
            "description": "Permission, scope, or plan denied"
          },
          "404": {
            "description": "Campaign or question not found"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      },
      "post": {
        "tags": [
          "Questions"
        ],
        "summary": "Add a draft question",
        "description": "Append a question to the draft. Provide at least a type and label. Type defaults apply to omitted properties. The live form updates the next time you publish.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "description": "Campaign UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "2fb99ad3-34ca-4d6f-b071-b050f0f11210"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Stable ID. Letters, digits, hyphens, and underscores. Omit when creating to generate one.",
                    "maxLength": 80
                  },
                  "type": {
                    "type": "string",
                    "description": "Supported question type key from GET /question-types."
                  },
                  "label": {
                    "type": "string",
                    "description": "Question wording or the text of a display field.",
                    "maxLength": 250
                  },
                  "required": {
                    "type": "boolean",
                    "description": "Whether a submitter must answer the question."
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Help text shown with the field."
                  },
                  "placeholder": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Placeholder for text inputs."
                  },
                  "options": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 2,
                    "maxItems": 100,
                    "description": "Distinct choice labels for select, radio, checkbox, and multiselect questions."
                  },
                  "default": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "array",
                      "null"
                    ],
                    "description": "Prefilled value. Use an array of choice labels for multiselect or checkbox."
                  },
                  "min": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "description": "Lowest allowed number or rating."
                  },
                  "max": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "description": "Highest allowed number or rating."
                  },
                  "min_length": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "max_length": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 50000
                  },
                  "identity": {
                    "type": "boolean",
                    "description": "Marks an answer as identifying information."
                  },
                  "receipt_email": {
                    "type": "boolean",
                    "description": "Whether an email question can receive submission receipts."
                  },
                  "accept": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Comma-separated MIME types for uploads."
                  },
                  "min_files": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 20
                  },
                  "max_files": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 20
                  },
                  "max_bytes": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "description": "Maximum bytes per file up to the platform limit."
                  },
                  "conditions": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "mode": {
                        "type": "string",
                        "enum": [
                          "and",
                          "or"
                        ]
                      },
                      "rules": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "field": {
                              "type": "string",
                              "description": "ID of the question to compare."
                            },
                            "operator": {
                              "type": "string",
                              "enum": [
                                "equals",
                                "not_equals",
                                "contains",
                                "answered"
                              ]
                            },
                            "value": {
                              "description": "Answer to compare against."
                            }
                          },
                          "required": [
                            "field"
                          ]
                        }
                      }
                    },
                    "description": "Visibility conditions. Referenced questions must exist in the draft."
                  }
                },
                "required": [
                  "type",
                  "label"
                ]
              },
              "example": {
                "type": "rating",
                "label": "How ready is your portfolio?",
                "id": "portfolio_rating"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Stable ID. Letters, digits, hyphens, and underscores. Omit when creating to generate one.",
                          "maxLength": 80
                        },
                        "type": {
                          "type": "string",
                          "description": "Supported question type key from GET /question-types."
                        },
                        "label": {
                          "type": "string",
                          "description": "Question wording or the text of a display field.",
                          "maxLength": 250
                        },
                        "required": {
                          "type": "boolean",
                          "description": "Whether a submitter must answer the question."
                        },
                        "min": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Lowest allowed number or rating."
                        },
                        "max": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Highest allowed number or rating."
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "label"
                      ]
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "portfolio_rating",
                    "type": "rating",
                    "label": "How ready is your portfolio?",
                    "required": false,
                    "min": 1,
                    "max": 5
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or expired API token"
          },
          "403": {
            "description": "Permission, scope, or plan denied"
          },
          "404": {
            "description": "Campaign or question not found"
          },
          "409": {
            "description": "Campaign is being deleted or an idempotency key conflicts"
          },
          "422": {
            "description": "Invalid question properties, order, or visibility references"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/campaigns/{campaign}/questions/{question}": {
      "get": {
        "tags": [
          "Questions"
        ],
        "summary": "Retrieve a draft question",
        "description": "Look up a field by its stable ID in the draft.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "description": "Campaign UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "2fb99ad3-34ca-4d6f-b071-b050f0f11210"
          },
          {
            "name": "question",
            "in": "path",
            "required": true,
            "description": "Stable question ID returned by the question endpoints.",
            "schema": {
              "type": "string"
            },
            "example": "portfolio_rating"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Stable ID. Letters, digits, hyphens, and underscores. Omit when creating to generate one.",
                          "maxLength": 80
                        },
                        "type": {
                          "type": "string",
                          "description": "Supported question type key from GET /question-types."
                        },
                        "label": {
                          "type": "string",
                          "description": "Question wording or the text of a display field.",
                          "maxLength": 250
                        },
                        "required": {
                          "type": "boolean",
                          "description": "Whether a submitter must answer the question."
                        },
                        "min": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Lowest allowed number or rating."
                        },
                        "max": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Highest allowed number or rating."
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "label"
                      ]
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "portfolio_rating",
                    "type": "rating",
                    "label": "How ready is your portfolio?",
                    "required": false,
                    "min": 1,
                    "max": 5
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or expired API token"
          },
          "403": {
            "description": "Permission, scope, or plan denied"
          },
          "404": {
            "description": "Campaign or question not found"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      },
      "patch": {
        "tags": [
          "Questions"
        ],
        "summary": "Update a draft question",
        "description": "Send the properties you want to change. Use null to clear optional settings. Changing type resets type-specific settings, and the ID stays the same.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "description": "Campaign UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "2fb99ad3-34ca-4d6f-b071-b050f0f11210"
          },
          {
            "name": "question",
            "in": "path",
            "required": true,
            "description": "Stable question ID returned by the question endpoints.",
            "schema": {
              "type": "string"
            },
            "example": "portfolio_rating"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Stable ID. Letters, digits, hyphens, and underscores. Omit when creating to generate one.",
                    "maxLength": 80
                  },
                  "type": {
                    "type": "string",
                    "description": "Supported question type key from GET /question-types."
                  },
                  "label": {
                    "type": "string",
                    "description": "Question wording or the text of a display field.",
                    "maxLength": 250
                  },
                  "required": {
                    "type": "boolean",
                    "description": "Whether a submitter must answer the question."
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Help text shown with the field."
                  },
                  "placeholder": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Placeholder for text inputs."
                  },
                  "options": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 2,
                    "maxItems": 100,
                    "description": "Distinct choice labels for select, radio, checkbox, and multiselect questions."
                  },
                  "default": {
                    "type": [
                      "string",
                      "number",
                      "boolean",
                      "array",
                      "null"
                    ],
                    "description": "Prefilled value. Use an array of choice labels for multiselect or checkbox."
                  },
                  "min": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "description": "Lowest allowed number or rating."
                  },
                  "max": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "description": "Highest allowed number or rating."
                  },
                  "min_length": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "max_length": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 50000
                  },
                  "identity": {
                    "type": "boolean",
                    "description": "Marks an answer as identifying information."
                  },
                  "receipt_email": {
                    "type": "boolean",
                    "description": "Whether an email question can receive submission receipts."
                  },
                  "accept": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Comma-separated MIME types for uploads."
                  },
                  "min_files": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 20
                  },
                  "max_files": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "maximum": 20
                  },
                  "max_bytes": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1,
                    "description": "Maximum bytes per file up to the platform limit."
                  },
                  "conditions": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "mode": {
                        "type": "string",
                        "enum": [
                          "and",
                          "or"
                        ]
                      },
                      "rules": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "field": {
                              "type": "string",
                              "description": "ID of the question to compare."
                            },
                            "operator": {
                              "type": "string",
                              "enum": [
                                "equals",
                                "not_equals",
                                "contains",
                                "answered"
                              ]
                            },
                            "value": {
                              "description": "Answer to compare against."
                            }
                          },
                          "required": [
                            "field"
                          ]
                        }
                      }
                    },
                    "description": "Visibility conditions. Referenced questions must exist in the draft."
                  }
                }
              },
              "example": {
                "label": "How would you rate this portfolio?"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Stable ID. Letters, digits, hyphens, and underscores. Omit when creating to generate one.",
                          "maxLength": 80
                        },
                        "type": {
                          "type": "string",
                          "description": "Supported question type key from GET /question-types."
                        },
                        "label": {
                          "type": "string",
                          "description": "Question wording or the text of a display field.",
                          "maxLength": 250
                        },
                        "required": {
                          "type": "boolean",
                          "description": "Whether a submitter must answer the question."
                        },
                        "min": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Lowest allowed number or rating."
                        },
                        "max": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "description": "Highest allowed number or rating."
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "label"
                      ]
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "portfolio_rating",
                    "type": "rating",
                    "label": "How would you rate this portfolio?",
                    "required": false,
                    "min": 1,
                    "max": 5
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or expired API token"
          },
          "403": {
            "description": "Permission, scope, or plan denied"
          },
          "404": {
            "description": "Campaign or question not found"
          },
          "409": {
            "description": "Campaign is being deleted or an idempotency key conflicts"
          },
          "422": {
            "description": "Invalid question properties, order, or visibility references"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      },
      "delete": {
        "tags": [
          "Questions"
        ],
        "summary": "Remove a draft question",
        "description": "Remove a field from the draft. Keep at least one field and update any visibility rules that refer to this ID before removing it.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "description": "Campaign UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "2fb99ad3-34ca-4d6f-b071-b050f0f11210"
          },
          {
            "name": "question",
            "in": "path",
            "required": true,
            "description": "Stable question ID returned by the question endpoints.",
            "schema": {
              "type": "string"
            },
            "example": "portfolio_rating"
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "401": {
            "description": "Invalid or expired API token"
          },
          "403": {
            "description": "Permission, scope, or plan denied"
          },
          "404": {
            "description": "Campaign or question not found"
          },
          "409": {
            "description": "Campaign is being deleted or an idempotency key conflicts"
          },
          "422": {
            "description": "Invalid question properties, order, or visibility references"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    },
    "/campaigns/{campaign}/questions/order": {
      "put": {
        "tags": [
          "Questions"
        ],
        "summary": "Reorder draft questions",
        "description": "Pass the complete list of draft question IDs in the new order. Include each ID exactly once.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "campaign",
            "in": "path",
            "required": true,
            "description": "Campaign UUID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "2fb99ad3-34ca-4d6f-b071-b050f0f11210"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "uniqueItems": true,
                    "minItems": 1,
                    "maxItems": 100
                  }
                },
                "required": [
                  "ids"
                ]
              },
              "example": {
                "ids": [
                  "portfolio_rating",
                  "title"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Stable ID. Letters, digits, hyphens, and underscores. Omit when creating to generate one.",
                            "maxLength": 80
                          },
                          "type": {
                            "type": "string",
                            "description": "Supported question type key from GET /question-types."
                          },
                          "label": {
                            "type": "string",
                            "description": "Question wording or the text of a display field.",
                            "maxLength": 250
                          },
                          "required": {
                            "type": "boolean",
                            "description": "Whether a submitter must answer the question."
                          },
                          "min": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Lowest allowed number or rating."
                          },
                          "max": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Highest allowed number or rating."
                          }
                        },
                        "required": [
                          "id",
                          "type",
                          "label"
                        ]
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "portfolio_rating",
                      "type": "rating",
                      "label": "How ready is your portfolio?",
                      "required": false,
                      "min": 1,
                      "max": 5
                    },
                    {
                      "id": "title",
                      "type": "text",
                      "label": "Portfolio title",
                      "required": true
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or expired API token"
          },
          "403": {
            "description": "Permission, scope, or plan denied"
          },
          "404": {
            "description": "Campaign or question not found"
          },
          "409": {
            "description": "Campaign is being deleted or an idempotency key conflicts"
          },
          "422": {
            "description": "Invalid question properties, order, or visibility references"
          },
          "429": {
            "description": "Request limit exceeded. Wait before retrying."
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Workspace"
    },
    {
      "name": "Campaigns"
    },
    {
      "name": "Questions"
    },
    {
      "name": "Submissions"
    },
    {
      "name": "Uploads"
    },
    {
      "name": "Files"
    },
    {
      "name": "Review"
    },
    {
      "name": "Webhooks"
    },
    {
      "name": "MCP"
    }
  ]
}
