{"openapi":"3.1.0","info":{"title":"ReportGeneratorTool API","version":"1.0.0"},"tags":[{"name":"delivery"}],"servers":[{"url":"https://api.reportgenerator.example.com","description":"Production example"},{"url":"https://api.staging.reportgenerator.example.com","description":"Staging example"}],"security":[{"WorkspaceApiKey":[]}],"components":{"securitySchemes":{"WorkspaceApiKey":{"type":"http","scheme":"bearer","description":"Workspace API key issued by your administrator."}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":true,"description":"Required key for 24-hour deduplication. A changed body with the same key returns 409.","schema":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[A-Za-z0-9._-]+$"}}},"schemas":{"EmailDeliveryRequest":{"type":"object","required":["sentTo"],"properties":{"sentTo":{"type":"array","minItems":1,"maxItems":20,"uniqueItems":true,"items":{"type":"string","format":"email"}}},"additionalProperties":false},"EmailDelivery":{"type":"object","required":["id","reportId","status","createdAt"],"properties":{"id":{"type":"string"},"reportId":{"type":"string"},"status":{"type":"string","enum":["queued","sending","sent","failed"]},"createdAt":{"type":"string","format":"date-time"},"error":{"oneOf":[{"$ref":"#/components/schemas/JobError"},{"type":"null"}]}}},"JobError":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["portal_login_failed","portal_unavailable","report_generation_failed","email_delivery_failed","internal_error"]},"message":{"type":"string","description":"Sanitized worker error."}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message","requestId"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{"type":"array","items":{"$ref":"#/components/schemas/ErrorDetail"}}}}}},"ErrorDetail":{"type":"object","required":["field","message"],"properties":{"field":{"type":"string"},"message":{"type":"string"}}}},"responses":{"Error400":{"description":"Invalid JSON, query parameter or cursor.","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error401":{"description":"Missing or invalid workspace API key.","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error403":{"description":"Insufficient permission.","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error404":{"description":"Resource not found in this workspace.","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error409":{"description":"Resource state or idempotency conflict.","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error410":{"description":"Report PDF has expired.","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error413":{"description":"Request exceeds 256 KiB.","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error415":{"description":"Use application/json.","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error422":{"description":"The request contains invalid fields.","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error429":{"description":"Workspace rate or concurrency limit reached.","headers":{"X-Request-Id":{"schema":{"type":"string"}},"Retry-After":{"schema":{"type":"integer","minimum":1},"description":"Seconds to wait before retrying."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error500":{"description":"Unexpected service failure.","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error503":{"description":"Temporary dependency failure.","headers":{"X-Request-Id":{"schema":{"type":"string"}},"Retry-After":{"schema":{"type":"integer","minimum":1},"description":"Seconds to wait before retrying."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/v1/reports/{reportId}/email-deliveries":{"post":{"tags":["delivery"],"operationId":"CreateEmailDelivery","summary":"Send report again","description":"Queue another email using an existing unexpired PDF. A fresh idempotency key intentionally sends a new message; a replay does not.","parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDeliveryRequest"}}}},"responses":{"202":{"description":"Delivery queued.","headers":{"X-Request-Id":{"schema":{"type":"string"}},"Location":{"schema":{"type":"string"},"description":"Relative URL /v1/email-deliveries/{deliveryId}."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDelivery"}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"410":{"$ref":"#/components/responses/Error410"},"413":{"$ref":"#/components/responses/Error413"},"415":{"$ref":"#/components/responses/Error415"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"500":{"$ref":"#/components/responses/Error500"},"503":{"$ref":"#/components/responses/Error503"}}}}}}