closeLoginaddNew PrmptsearchSearchSignup2,0002,000menu

API Reference

Prmptly.xyz provides an API to allow you easy integration of Prmpts into your projects. This API is governed by our Terms of Service.

To use the API, you need an API key. The API key is a unique identifier that allows you to authenticate your requests and track your usage.

The API is designed to be easy to use and understand. It follows RESTful principles and uses standard HTTP methods (GET, POST, PUT, DELETE) to perform operations on resources.

The API returns data in JSON format, which is easy to parse and use in your applications.

Api Key

To use the API, you need an API key. Create an account to get your API Key.

Endpoints

All requests need to be made to https://api.prmptly.xyz/:endpoint. Below are the different public endpoints you can use:

GET /prmpt/:prmptId/list-models

Get the list of models available for a given Prmpt including the fees.

Example:

let response = await fetch('https://api.prmptly.xyz/prmpt/:prmptId/list-models', {
	method: 'GET',
	headers: {
		'X-API-KEY': 'YOUR_API_KEY'
	}
});
if(!response.ok) {
	console.error('Error:', response.statusText);
} else {
	let data = await response.json();
	console.log(data);
}

Parameters:

Response:

{
	"type": "text", // or "image"
	"models": [
		{
			"handle": "lite",
			"name": "Lite",
			"description": "Affordable & smaller model",
			"price": 20,
			"available": true
		},
		{
			"handle": "Pro",
			"name": "Pro",
			"description": "Higher detail and photo-realistic images",
			"price": 300,
			"available": false,
			"notAvailableReason": "INSUFFICIENT_TOKENS"
		}
	]
}

POST /prmpt/:prmptId/run

Run a prmpt.

Example:

let response = await fetch('https://api.prmptly.xyz/prmpt/:prmptId/run', {
	method: 'POST',
	headers: {
		'X-API-KEY': 'YOUR_API_KEY',
		'Content-Type': 'application/json'
	},
	body: JSON.stringify({
		approvedFee: 20,
		model: 'lite',
		inputs: {
			"inputHandle": "Input Value"
		}
	})
});
if(!response.ok) {
	console.error('Error:', response.statusText);
} else {
	let data = await response.json();
	console.log(data);
}

Parameters:

Response:

// Text prompt response
{
	"status"		: "success",
	"prmptId"		: "xxxxxxxx",
	"prmptRunId"	: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
	"type"			: "text",
	"model"			: "lite", // or "pro"
	"totalFee"		: 20,
	"output": "Output Text"
}
// Image prmpt response
{
	"status"		: "success",
	"prmptId"		: "xxxxxxxx",
	"prmptRunId"	: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
	"type"			: "image",
	"model"			: "lite", // or "pro"
	"totalFee"		: 160,
	"output": [
		{
			"url"		: "https://static.prmptly.xyz/[...]",
			"width"		: 1024,
			"height"	: 1024,
		},
		{
			"url"		: "https://static.prmptly.xyz/[...]",
			"width"		: 1024,
			"height"	: 1024,
		}
	]
}
// Error response
{
	"status": "error",
	"error": "Not enough funds to process this request.",
}