Polls the status of an asynchronous background job (e.g. AI preview via Bedrock). Returns the job record including status and result payload.
Authentication
Requires JWT Bearer token (Cognito). Jobs are scoped to the requesting user — you cannot access other users’ jobs.
Path Parameters
Job UUID returned from the job-creating endpoint (e.g. POST /api/admin/prompts/preview)Format: UUIDExample: 550e8400-e29b-41d4-a716-446655440000
Response
Job type enum valueValues: AI_PREVIEW, PARSE_DOCUMENT, GAP_DETECTION, RISK_ANALYSIS, REPORT_GENERATION
Current job statusValues: PENDING, PROCESSING, COMPLETED, FAILEDPoll every 3 seconds until status is COMPLETED or FAILED
Output from the worker Lambda when status is COMPLETED. Structure varies by job type.For AI_PREVIEW jobs:
output (string): The AI-generated preview text
Error message if status is FAILED
Number of processing attempts (max 3 retries)
ISO 8601 timestamp when the job was created
ISO 8601 timestamp when processing started
ISO 8601 timestamp when the job completed or failed
ISO 8601 timestamp of last status update
Example Request
curl -X GET https://api.example.com/api/jobs/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
Example Response (Completed)
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"type": "AI_PREVIEW",
"status": "COMPLETED",
"result": {
"output": "The main market risks identified are price volatility, lack of market access, and limited contract farming opportunities. Recommendations include establishing farmer cooperatives, diversifying market channels, and implementing price risk management strategies."
},
"error": null,
"attempts": 1,
"createdAt": "2026-03-04T12:00:00.000Z",
"startedAt": "2026-03-04T12:00:01.000Z",
"completedAt": "2026-03-04T12:00:05.000Z",
"updatedAt": "2026-03-04T12:00:05.000Z"
}
Example Response (Processing)
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"type": "AI_PREVIEW",
"status": "PROCESSING",
"result": null,
"error": null,
"attempts": 1,
"createdAt": "2026-03-04T12:00:00.000Z",
"startedAt": "2026-03-04T12:00:01.000Z",
"completedAt": null,
"updatedAt": "2026-03-04T12:00:02.000Z"
}
Example Response (Failed)
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"type": "AI_PREVIEW",
"status": "FAILED",
"result": null,
"error": "Bedrock API error: ThrottlingException - Rate exceeded",
"attempts": 3,
"createdAt": "2026-03-04T12:00:00.000Z",
"startedAt": "2026-03-04T12:00:01.000Z",
"completedAt": "2026-03-04T12:00:15.000Z",
"updatedAt": "2026-03-04T12:00:15.000Z"
}
Error Responses
Missing or invalid Bearer token
Job not found or does not belong to the requesting user
Source Code
Implementation: packages/api/src/jobs/jobs.controller.ts:19