post https://api.aeronpay.in/api/serviceapi-prod/api/ai/fetch-response
Fetch Response API
The Fetch Response API allows you to retrieve AI-generated responses using a context token. This endpoint is typically used after initiating an AI request to get the processed response.
Endpoint
POST https://api.aeronpay.co.in/payal-api/api/serviceapi-prod/api/ai/fetch-response
Authentication
Include your authentication credentials in the request headers:
client-id: Your unique client IDclient-secret: Your secure client secret key
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
client_referenceId | string | Yes | Unique client reference ID (max 30 characters) |
context_token | string | Yes | Unique token received in the response of Create API |
Request Example
{
"client_referenceId": "AI5687654362456",
"context_token": "apay_68946e7042d481a3829228037001395f08ecc0bf999ba6b7"
}Response Structure
Success Response (200)
{
"status": "SUCCESS",
"status_code": "200",
"message": "Response fetched successfully.",
"response_status": "completed",
"context_token": "apay_68946e7042d481a3829228037001395f08ecc0bf999ba6b7",
"parent_context_token": null,
"system": {
"msg_id": "msg_68946e718b8c81a388c1b442e9be4ef408ecc0bf999ba6b7",
"text": "India is a diverse and vibrant country in South Asia, known for its rich cultural heritage, ancient history, and democratic governance. It is the world's second-most populous nation and features a variety of languages, religions, and traditions. India is a rapidly developing economy with significant contributions in technology, agriculture, and industry."
}
}Response Fields
| Field | Type | Description |
|---|---|---|
status | string | Status of the API call (SUCCESS/FAILED) |
status_code | string | HTTP status code |
message | string | Descriptive message about the response |
response_status | string | Status of the AI response processing (completed/processing/failed) |
context_token | string | The context token used for this request |
parent_context_token | string/null | Parent context token if applicable |
system | object | Contains the AI response data |
system.msg_id | string | Unique message identifier |
system.text | string | The actual AI-generated response text |
Response Status Values
- completed: The AI response has been fully processed and is ready
- processing: The request is still being processed
- failed: The request failed to process
Error Handling
If the request fails, you'll receive an error response with appropriate status codes and error messages. Common error scenarios include:
- Invalid context token
- Expired context token
- Missing required parameters
- Authentication failures