Custom APIs

Custom APIs emporwer Hyperflow users to create, update, ingest, delete or retrieve their AI-driven services and automations

/admin/customapis/get
Retrieve the information about your existing Custom APIs.
REST API
GET /admin/customapis/get
Input query parameters
id
Optional
if provided, this API returns information about the Custom API matching the id provided. Otherwise, it returns the full list of Custom APIs.
Example of a call to retrieve the full list of Policies:
curl https://{{ tenant }}.lightenup.ai/admin/customapis/get \
--request GET \
--header "Authorization: Bearer xyz"
Example a call to retrieve a particular Policies:
curl https://{{ tenant }}.lightenup.ai/admin/customapis/get?id={{id}} \
--request GET \
--header "Authorization: Bearer xyz"

Outputs
Response Code
200

This API returns an array of Policies  in JSON format:

id
Id of the Data source retrieved
name
Name of the data source
description
Description of the data source
roleID
Existing roleID used to run this CustomAPI
content
The business logic to be executed by AI
input
Input parameters schema
output_type
Output type: JSON, MARKDOWN or TEXT
output
Output payload schema
state
The current state,
0 disabled and 1 enabled
created_at
Date and time of Policy creation
last_updated
Date and of Policy latest update
Response example:
{
  "id": "52fa41b7-021d-4efc-af6f-9f1e9e19b3a9",
  "name": "products_live_data",
  "description": "Contains PDP data",
  "roleID": "123345",
  "content": "Generate a live a report of the product with {product_id} including all the information available related to it",
  "input": "[\"product_id\": \"string\"]",
  "output_type": "JSON",
  "output": "[\"report\": \"string\"]",
  "state": "1",
  "created_at": "2024-02-16T20:23:54.025Z",
  "last_update": "2024-02-16T20:23:54.025Z"  
}

Response Code
400

Error message in JSON format:

message
Error message
Response Example:
{
  "message": "Missing parameters",
}

Response Code
500

Error message in JSON format:

message
Error message
Response exdmple:
{
  "message": "Internal server error",
}
/admin/customapis/create
Creates a new Custom API source
REST API
POST /admin/customapis/create
Input Body parameters (JSON)
name
required
Name of the Data source to be created
description
required
Description of the Data source to be created
type
required
The type of data source
state
required
The current state of the data source (enabled or disabled)
Example of a call to retrieve the full list of CustomAPIs:

curl https://{{ tenant }}.lightenup.ai/admin/customapis/create \
--request POST \
--header "Authorization: Bearer xyz" \
--header "Content-Type: application/json" \
--data @- << EOF
{
  "name": "products_live_data",
  "description": "Contains PDP data",
  "roleID": "123345",
  "content": "Generate a live a report of the product with {product_id} including all the information available related to it",
  "input": "[\"product_id\": \"string\"]",
  "output_type": "JSON",
  "output": " "[\"report\": \"string\"]",
  "state": "1",
}
EOF

Outputs
Response Code
200

This API returns the following JSON payload schema:

message
Custom API created
id
The id of the Custom API created
Response example:
{
   "message": "Custom API created",
   "id": "52fa41b7-021d-4efc-af6f-9f1e9e19b3a9" 
}

Response Code
400

Error message in JSON format:

message
Error message
Response Example:
{
  "message": "Missing parameters",
}

Response Code
500

Error message in JSON format:

message
Internal server error
Response exdmple:
{
  "message": "Internal server error",
}
/admin/customapis/update
Updates an existing Custom API
REST API
POST /admin/customapis/update
Input Body parameters (JSON)
id
required
Id of the Custom API to be updated
name
required
The new name of the Custom API being updated
description
required
The new description of the Custom API being updated
content
required
Instruction or business logic to be executed by the Custom API
Input
required
Input parameters schema in JSON
output_type
required
JSON, TEXT or MARKDOWN
output
required
If output type is JSON, the output schema in JSON
state
required
Values: (0) disabled, (1) enabled
Example of a call to retrieve the full list of Actions:
curl https://{{ tenant }}.lightenup.ai/admin/customapis/update \
--request POST \
--header "Authorization: Bearer xyz" \
--header "Content-Type: application/json" \
--data @- << EOF
{
 "id": "52fa41b7-021d-4efc-af6f-9f1e9e19b3a9",
  "name": "products_live_data",
  "description": "Contains PDP data",
  "roleID": "123345",
  "content": "Generate a live a report of the product with {product_id} including all the information available related to it",
  "input": "[\"product_id\": \"string\"]",
  "output_type": "JSON",
  "output": " "[\"report\": \"string\"]",
  "state": "1",
}
EOF

Outputs
Response Code
200

This API returns the following JSON payload schema:

message
Action updated
id
The id of the Action created
Response example:
{
  "message": "Custom API updated",
  "id": "52fa41b7-021d-4efc-af6f-9f1e9e19b3a9"  
 }

Response Code
400

Error message in JSON format:

message
Error message
Response Example:
{
  "message": "Missing parameters"
 }

Response Code
500

Error message in JSON format:

message
Error message
Response exdmple:
{
  "message": "Internal server error"
 }
/admin/customapis/delete
Deletes an existing Custom API
REST API
POST /admin/customapis/delete
Input Body parameters (JSON)
id
required
Id of the Custom API to be deleted
Example of a call to delete an existing Custom APIs:
curl https://{{ tenant }}.lightenup.ai/admin/customapis/delete?id=111 \
--request DELETE \
--header "Authorization: Bearer xyz"

Outputs
Response Code
200

This API returns the following JSON payload schema:

message
Custom API  deleted
id
The id of the Custom API deleted
Response example:
{
  "message": "Custom API deleted",
  "id": "52fa41b7-021d-4efc-af6f-9f1e9e19b3a9"  
 }

Response Code
400

Error message in JSON format:

message
Error message
Response Example:
{
  "message": "Missing parameters"
 }

Response Code
500

Error message in JSON format:

message
Error message
Response exdmple:
{
  "message": "Internal Server error"
 }