Skip to main content

Data API Documentation

GET: Retrieve Data

Description

This route is used to retrieve a list of all the questions your users have asked and the answer your copilot have given specific to this project and optional search capabilities.

Method

GET

Query Parameters

  • sort (string): The field by which to sort the data.
  • page (number): The page number of the results.
  • limit (number): The number of items per page.
  • searchTerm (string): Optional search term to filter data.

Response

  • Returns a JSON response with the list of data or an error message.

Status Codes

  • 200 OK: Data retrieved successfully.
  • 500 Internal Server Error: Error listing data.

Throws

  • An error if request validation or data retrieval fails.

Example cURL

curl --location 'https://app.ai12z.net/api/projects/{projectId}/data' \
--header 'Authorization: Bearer <YOUR_KEY>' \
--data-urlencode 'sort=name' \
--data-urlencode 'page=1' \
--data-urlencode 'limit=10'

GET: Retrieve Data by ID

Description

This route is used to retrieve details of a specific data by its ID.

Method

GET

URL Parameters

  • id (string): The ID of the data to retrieve.

Response

  • Returns a JSON response with data details such as id,modelname,query and answer.

Status Codes

  • 200 OK: Data retrieved successfully.
  • 500 Internal Server Error:Error retrieving the Data.

Throws

  • An error if the data is not found or any other error occurs.

Example cURL

curl --location 'https://app.ai12z.net/api/projects/{projectId}/data' \
--header 'Authorization: Bearer <YOUR_KEY>'

DELETE: Delete a Data

Description

This route is used to delete an existing data.

Method

DELETE

Request Body

Example request body:

{
"id": "Data ID"
}

Response

  • Returns a confirmation message indicating successful deletion.

Status Codes

  • 200 OK: Data deleted successfully.
  • 500 Internal Server Error: Error deleting the data.

Throws

  • An error if request validation or id deletion fails.

Example cURL

curl --location --request DELETE 'https://app.ai12z.net/api/projects/{projectId}/data' \
--header 'Authorization: Bearer <YOUR_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": "Data ID"
}'