Structuring the Request

Now you have the Prompt ID, you can build out the request to use in your own system. We like to test all of our API requests using a tool called Postman. Well worth picking it up if you don't have it. It is free to use.

What Postman is great at is that it lets you import a CURL request and then try it out instantly. This is great for experimenting and ensuring you have everything set up properly. You can then also get a code snippet for multiple other technologies such as Python, Javascript, NodeJS, and much more.

curl --location --request POST 'https://prompts.riku.ai/webhook/run' \
--header 'Content-Type: application/json' \
--data-raw '{
	"Name": "NAME OF ACCOUNTHOLDER",
	"Secret": "SECRET KEY (GET FROM MANAGE ACCOUNT)",
	"Prompt ID": "COPY FROM RUN PROMPT PAGES",
	"Input 1": "THE FIRST INPUT",
	"Input 2": "THE SECOND INPUT",
	"Input 3": "THE THIRD INPUT",
	"Input 4": "THE FOURTH INPUT",
	"Input 5": "THE FIFTH INPUT",
	"n": <number of how many varations to generate>
}'

This is the request you can use for anything you want to use from Riku. The POST request is going to an endpoint regardless of which technology the prompt is using and we will route it accordingly for you.

In the code example above, we provide data for Input 1 - 5. Our system will automatically exclude any Inputs that are not relevant to the Prompt ID specified. If you have a Prompt ID with zero inputs, you can still include the Input fields but they won't be used for anything.

The main points to keep in mind for beginners when using this request are;

  • It is a POST request.

  • There is one header field of "Content-Type": "application/json".

  • The "n" field is a number and generally, we don't recommend putting that as more than 6. Also, ensure that you do not put that number in quotations. It should be "n": 5 and not "n": "5". Final note to remember is that the final field of the JSON does not have a comma at the end.

Last updated