Unltd AI logo

Getting started


Get Bot Requests

GET https://api.unltd.ai/v1/requests/

This endpoint retrieves a list of BotRequest entities associated with the authenticated user. The response can be tailored using the provided query parameters. These parameters enable filtering of bot requests by bot name, as well as pagination and sorting of the response. Please note, the results are strictly user-specific, returning only bot requests relevant to the authenticated user.

Query Parameters

name

String

The name of the bot to filter requests by.

sortBy

String

The attribute to sort by.

limit

Integer

The maximum number of bot requests to return.

page

Integer

The page number to return in the paginated response.

Permissions

This request necessitates user authentication. The response exclusively provides bot requests that are pertinent to the authenticated user. The returned bot requests are either created directly by the user or linked to the organizations that the user is a part of. Therefore, the API will not yield results unrelated to the authenticated user making the request.

API Example

const fetch = require('node-fetch');

async function fetchApiData() {
  const response = await fetch('https://api.unltd.ai/v1/requests/', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer ',
      'Content-Type': 'application/json',
    },
  });

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

fetchApiData();

Response Object

200 success

The response object contains the following properties:

  • results: An array of BotRequest entities.
  • page: The current page number.
  • limit: The maximum number of results per page.
  • totalPages: The total number of pages.
  • totalResults: The total number of BotRequest entities.
{
  "results": [
    {
      "bot": {
        "creditCost": 10,
        "name": "Example bot",
        "slug": "example_bot"
      },
      "createdBy": {
        "name": "John Doe"
      },
      "organization": {
        "name": "Test Organization"
      },
      "inputs": {
        "color": "Green"
      },
      "ip": "29.251.124.244",
      "response": {
        "message": "Hello world"
      },
      "createdAt": "2023-06-28T05:38:00.418Z",
      "updatedAt": "2023-06-28T05:38:06.922Z",
      "id": "649bc73858b7391cbaa555ff"
    }
  ],
  "page": 1,
  "limit": 10,
  "totalPages": 1,
  "totalResults": 1
}

Get Custom Bot Requests

GET https://api.unltd.ai/v1/organizations/example_organization_id/requests/

This endpoint retrieves a list of BotRequest entities associated with the given organization ID. The authenticated user needs to be a part of the specified organization. The response can be customized using the provided query parameters, which allow filtering of bot requests by bot name, as well as pagination and sorting of the response.

Query Parameters

name

String

The name of the bot to filter requests by.

sortBy

String

The attribute to sort by.

limit

Integer

The maximum number of bot requests to return.

page

Integer

The page number to return in the paginated response.

Permissions

This request requires either user authentication or an organization token, and the user or the token should be associated with the specified organization. The response provides bot requests that are related to the specified organization and relevant to the authenticated user or the entity represented by the organization token.

API Example

const fetch = require('node-fetch');

async function fetchApiData() {
  const response = await fetch('https://api.unltd.ai/v1/organizations/example_organization_id/requests/', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer ',
      'Content-Type': 'application/json',
    },
  });

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

fetchApiData();

Response Object

200 success

The response object contains the following properties:

  • results: An array of BotRequest entities.
  • page: The current page number.
  • limit: The maximum number of results per page.
  • totalPages: The total number of pages.
  • totalResults: The total number of BotRequest entities.
{
  "results": [
    {
      "bot": {
        "creditCost": 10,
        "name": "Example bot",
        "slug": "example_bot"
      },
      "createdBy": {
        "name": "John Doe"
      },
      "organization": {
        "name": "Test Organization"
      },
      "inputs": {
        "color": "Green"
      },
      "ip": "29.251.124.244",
      "response": {
        "message": "Hello world"
      },
      "createdAt": "2023-06-28T05:38:00.418Z",
      "updatedAt": "2023-06-28T05:38:06.922Z",
      "id": "649bc73858b7391cbaa555ff"
    }
  ],
  "page": 1,
  "limit": 10,
  "totalPages": 1,
  "totalResults": 1
}

Get Single Bot Request

GET https://api.unltd.ai/v1/requests/:botRequestId/

This endpoint retrieves a specific BotRequest entity based on the provided bot request ID. The response contains detailed information about the requested bot request. Depending on the user's role and associated organizations, different information may be returned.

Path Parameters

botRequestId

string

The unique ID of the bot request to be retrieved.

Permissions

This request necessitates user authentication. The response provides BotRequest entities exclusively associated with the authenticated user. The user must be the owner of the bot request, or belong to an organization that initiated the bot request. It's important to note that the API will only yield bot requests relevant to the authenticated user or their associated organizations.

API Example

const fetch = require('node-fetch');

async function fetchApiData() {
  const response = await fetch('https://api.unltd.ai/v1/requests/example_request/', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer ',
      'Content-Type': 'application/json',
    },
  });

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

fetchApiData();

Response Object

200 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": "Green"
  },
  "ip": "29.251.124.244",
  "response": {
    "message": "Hello world"
  },
  "createdAt": "2023-06-28T05:38:00.418Z",
  "updatedAt": "2023-06-28T05:38:06.922Z",
  "id": "649bc73858b7391cbaa555ff"
}

Get Single Bot Request for an Organization

GET https://api.unltd.ai/v1/organizations/:organizationId/requests/:botRequestId/

This endpoint retrieves a specific BotRequest entity for an organization based on the provided bot request ID. The response contains detailed information about the requested bot request.

Path Parameters

organizationId

string

The unique ID of the organization.

botRequestId

string

The unique ID of the bot request to be retrieved.

Permissions

This request requires user or organization token authentication. The response provides BotRequest entities that are exclusively associated with the authenticated user or the specified organization. When accessed by a user, the user must either be the owner of the bot request or belong to the specified organization. When accessed via an organization token, the BotRequest entities returned must belong to the authenticated organization. Note that this API endpoint will only return bot requests that are relevant to the authenticated user or the authenticated organization.

API Example

const fetch = require('node-fetch');

async function fetchApiData() {
  const response = await fetch('https://api.unltd.ai/v1/organizations/example_organization/requests/example_request/', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer ',
      'Content-Type': 'application/json',
    },
  });

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

fetchApiData();

Response Object

200 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": "Green"
  },
  "ip": "29.251.124.244",
  "response": {
    "message": "Hello world"
  },
  "createdAt": "2023-06-28T05:38:00.418Z",
  "updatedAt": "2023-06-28T05:38:06.922Z",
  "id": "649bc73858b7391cbaa555ff"
}