🔗API

General Information

Prst.ai offers a set of API using HTTP to control your prompt management outside the system. The API is designed to provide all important information to you with ability to manage your prompts programmatically.

Authentication

PRST API requires authentication using API Credentials that can be created from UI of your prst.ai installation .

The API Credentials Key should be provided in Request Headers with prefix Bearer in header value.

API Versioning

Prst.ai uses the path versions to differentiate between APIs. In cases when updates does not match with the API old scheme the new version will be used to access endpoint.

This approach helps your team to prevent issues after prst.ai version update.

Errors

The API returns Errors in the following structure:

{
   "serverCode": 403,
   "name": "ACCOUNT_TERMINATED",
   "code": "PRST-SSO-ERR-00013",
   "message": "Account Terminated",
   "description": "Sorry, but your account was terminated. If you think this is a mistake, please contact your admin.',
},

💡 Note: If you see any unhandled error we will be glad to hear from you about that case.

Swagger

Before installation you can check all available API in our publicly available Swagger.

💡 Note: If you didn't find API you're looking for, please contact us, maybe we have to update docs 😊

Health-check API

To be compatible with many container management solutions prst.ai provides a simple HTTP endpoint for the healthcek. using this endpoint it's possible to ensure stability of your solution.

curl --fail http://localhost:8080/api/v1/health || exit 1

By default health-check endpoint returns the actual version of prst.ai installation.

Execution API

This API provides several alternative way to pass parameters. We believe that those options can make it more easier to integrate your AI pipelines with prst.ai

For example you can provide prompt parameters in the following way:

{
  "prompt": {
    "id": 0,
    "version": "string",
    "params": {
        "param_1":"VALUE",
        "param_2":"VALUE_2"
    }
  },
  "connector": {
    "id": 0,
    "version": "string"
  },
  "async": true
}

Or alternative one could be the following:

{
  "prompt": {
    "id": 0,
    "version": "string",
    "params": [ 
        "VALUE",
        "VALUE_2"
    ]
  },
  "connector": {
    "id": 0,
    "version": "string"
  },
  "async": true
}

Execution Behaviors

On addition to that it's possible to define execution behavior:

  • sync: the execution will be done within one session;

  • async: the execution will work as Fire-And-Forget and you will be able to check execution status later when it's needed.

Define your desired approach by configuring "async":true parameter.

Prompt Creation API

An alternative way to create prompt is API that uses prompt markup. To create a new prompt using this API you can simply call it with the following parameters:

{
  "name": "string"
  "markup": "string"
}

In this case system will automatically create all related entities and will assign parameters.

Last updated