List Input

List Input API

The List Input API allows you to retrieve a list of input items associated with a specific context token. This API is useful for fetching conversation history or input data in a structured format.

Endpoint

POST https://api.aeronpay.co.in/payal-api/api/serviceapi-prod/api/ai/list-input

Request Parameters

FieldTypeRequiredDescription
client_referenceIdstringYesA string identifier provided by the client, max 30 characters
context_tokenstringYesUnique token received in the response of Create API
data_orderstringNoDetermines sorting order. Values are asc or desc

Request Example

{
    "client_referenceId": "APAY62737678323",
    "context_token": "apay_689477356698819288abedc5fe35d92c03f17a6a593fca89",
    "data_order": "asc"
}

Response Structure

The API returns a JSON response with the following structure:

  • status: Indicates the success or failure of the request
  • status_code: HTTP status code as a string
  • message: Descriptive message about the operation
  • data: Array of input/response objects containing:
    • msg_id: Unique identifier for each message
    • request_status/response_status: Status of the request or response (e.g., "completed")
    • user: Object containing user input text
    • system: Object containing system response text

Response Example

{
    "status": "SUCCESS",
    "status_code": "200",
    "message": "Input items fetched successfully.",
    "data": [
        {
            "msg_id": "msg_68946f9400c08192a72571afdf2c270803f17a6a593fca89",
            "request_status": "completed",
            "user": {
                "text": "Laravel Short Description."
            }
        },
        {
            "msg_id": "msg_68946f948cdc8192bec8a22fda97dca403f17a6a593fca89",
            "response_status": "completed",
            "system": {
                "text": "**Laravel** is a popular open-source PHP web framework designed for building modern, secure, and scalable web applications. It follows the MVC (Model-View-Controller) architectural pattern and offers an elegant syntax, robust tools, and built-in features like routing, authentication, ORM (Eloquent), caching, and queue management to streamline development."
            }
        },
        {
            "msg_id": "msg_6894773571848192b826ed1a4005535603f17a6a593fca89",
            "request_status": "completed",
            "user": {
                "text": "give its example code snippet."
            }
        }
    ]
}

Usage Notes

  1. Context Token: The context_token must be a valid token obtained from a previous API call (typically from a Create API endpoint).

  2. Data Ordering:

    • Use "asc" for ascending order (oldest to newest)
    • Use "desc" for descending order (newest to oldest)
    • If not specified, default ordering will be applied
  3. Message Types: The response data contains two types of messages:

    • User messages: Contain request_status and user object with input text
    • System messages: Contain response_status and system object with response text
  4. Client Reference ID: Should be unique for each request and limited to 30 characters maximum.

Error Handling

If the request fails, the API will return an appropriate error status and message. Common error scenarios include:

  • Invalid or expired context token
  • Missing required parameters
  • Invalid data_order value
Language
Click Try It! to start a request and see the response here!