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 ID
  • client-secret: Your secure client secret key

Request Parameters

ParameterTypeRequiredDescription
client_referenceIdstringYesUnique client reference ID (max 30 characters)
context_tokenstringYesUnique 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

FieldTypeDescription
statusstringStatus of the API call (SUCCESS/FAILED)
status_codestringHTTP status code
messagestringDescriptive message about the response
response_statusstringStatus of the AI response processing (completed/processing/failed)
context_tokenstringThe context token used for this request
parent_context_tokenstring/nullParent context token if applicable
systemobjectContains the AI response data
system.msg_idstringUnique message identifier
system.textstringThe 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
Language
Click Try It! to start a request and see the response here!