# Task Callback

Source: https://recoupable.dev/docs/api-reference/content-agent/callback

Internal callback endpoint for the `poll-content-run` Trigger.dev task. Receives content generation results and posts them back to the originating Slack thread. Authenticated via the `x-callback-secret` header.

## POST /api/content-agent/callback

Full OpenAPI specification: https://recoupable.dev/docs/spec/content.json

## Authentication

This operation requires one of the security alternatives in the specification below. Security scheme definitions are included where present in the published specification.

[Authentication guide](https://recoupable.dev/docs/authentication)

Documentation gap: the published specification names `callbackSecret` but does not define that security scheme. Check the full specification and authentication guide before calling this operation.

## Operation and referenced schemas

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Recoup API - Content",
    "description": "API documentation for the Recoup platform - an AI agent platform for the music industry",
    "license": {
      "name": "MIT"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.recoupable.dev"
    }
  ],
  "paths": {
    "/api/content-agent/callback": {
      "post": {
        "description": "Internal callback endpoint for the `poll-content-run` Trigger.dev task. Receives content generation results and posts them back to the originating Slack thread. Authenticated via the `x-callback-secret` header.\n\nThis endpoint is not intended for external use — it is called automatically by the polling task when content runs complete, fail, or time out.",
        "requestBody": {
          "description": "Content generation results from the polling task",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "threadId",
                  "status"
                ],
                "properties": {
                  "threadId": {
                    "type": "string",
                    "description": "Chat SDK thread identifier for the originating Slack thread"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "completed",
                      "failed",
                      "timeout"
                    ],
                    "description": "Overall status of the content generation batch"
                  },
                  "results": {
                    "type": "array",
                    "description": "Per-run results",
                    "items": {
                      "type": "object",
                      "required": [
                        "runId",
                        "status"
                      ],
                      "properties": {
                        "runId": {
                          "type": "string",
                          "description": "Trigger.dev run ID"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "completed",
                            "failed",
                            "timeout"
                          ]
                        },
                        "videoUrl": {
                          "type": "string",
                          "description": "URL of the generated video (when completed)"
                        },
                        "captionText": {
                          "type": "string",
                          "description": "Generated caption text (when completed)"
                        },
                        "error": {
                          "type": "string",
                          "description": "Error message (when failed)"
                        }
                      }
                    }
                  },
                  "message": {
                    "type": "string",
                    "description": "Optional human-readable message"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Callback processed and results posted to Slack",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request body"
          },
          "401": {
            "description": "Missing or invalid callback secret"
          }
        },
        "security": [
          {
            "callbackSecret": []
          }
        ]
      }
    }
  }
}
```
