Skip to main content

Making requests to Pika API

To generate image using Pika API, you need to have to two things:

  • Template ID
  • Template modifications

You can learn more about Template ID and modifications and how to find them here

Once you have those, you can generate image by making a request like so:

const response = await fetch(`${PIKA_TEMPLATE_ID}/images`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${PIKA_API_KEY}`,
body: JSON.stringify({
response_format: "base64", // Optional, default is base64
modifications: {
}).then((res) => res.json());

Note the three variables in the request

  • PIKA_TEMPLATE_ID: ID of the image template you want to generate image from
  • PIKA_API_KEY: Your Pika API key
  • YOUR_MODIFICATIONS: Modification values for the template