Unltd AI logo

Getting started


Update Bot Request

POST https://api.unltd.ai/v1/bots/:botSlug/request/:requestId/

This endpoint creates a new BotRequest entity for a specific bot and links it to an existing BotRequest. The new BotRequest is created based on the provided information in the request body. The ID of the original BotRequest is then attached to the 'originalRequest' field of the new BotRequest, while the ID of the new BotRequest is appended to the 'relatedRequests' field of the original BotRequest.

Request Body

editAction

string

The action to be performed for the update. Supported editActions: 'improve', 'rephrase', 'continue', 'expand', 'shorten', 'plagiarism'.

editValue

string

The new value to be set for the action.

inputs

object

The inputs for the bot follow a {name: value} structure in which 'name' corresponds to the botInput name defined by the bot and 'value' corresponds to the actual input provided by the user.

Permissions

This request can be made by a user who is authenticated either via a user account or an organization token. It's important to note that this endpoint may only update BotRequest entities associated with the authenticated user or organization.

API Example

const fetchApiData = async () => {
  const response = await fetch("https://api.unltd.ai/v1/bots/example_bot_slug/request/example_request_id/", {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer ',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      editAction: 'example_action',
      editValue: 'example_value',
      inputs: '[object Object]'
    })
  });

  const data = await response.json();
  console.log(data);
};

fetchApiData();

Response Object

201 success

The response object will be returned as a BotRequest.
{
  "bot": {
    "creditCost": 10,
    "name": "Example bot",
    "slug": "example_bot"
  },
  "createdBy": {
    "name": "John Doe"
  },
  "organization": {
    "name": "Test Organization"
  },
  "inputs": {
    "color": "Blue"
  },
  "ip": "29.251.124.244",
  "response": {
    "message": "Updated hello world"
  },
  "createdAt": "2023-06-28T05:38:00.418Z",
  "updatedAt": "2023-06-28T06:38:06.922Z",
  "id": "649bc73858b7391cbaa555ff",
  "originalRequest": "649bc73858b7391cbaasdadas"
}