Skip to content
On this page

Getting Started with PromptChainer API

Introduction

Welcome to the PromptChainer API! This API allows you to create and manage conversational flows for your chatbot or voice assistant. With the PromptChainer API, you can easily create complex conversational flows that can handle user input, make API calls, and more.

This guide will walk you through the basics of using the PromptChainer API, including how to authenticate with the API, how to make requests, and how to handle responses and errors. By the end of this guide, you should have a good understanding of how to use the PromptChainer API to create powerful conversational flows for your chatbot or voice assistant.

Before we get started, make sure you have the necessary prerequisites installed and set up. If you need help with this, check out the Prerequisites section below.

Prerequisites

Before you can use the PromptChainer API, you'll need to have an API key for the API.

To obtain an API key for the PromptChainer API, follow these steps:

  1. Sign up for an account on the PromptChainer website: https://www.promptchainer.io/
  2. Navigate to the API Keys section of your account dashboard
  3. Generate a new API key for the PromptChainer API
  4. Copy the API key and keep it in a safe place

Once you have an API key for the PromptChainer API, you're ready to start using the API!

Authentication

To authenticate with the PromptChainer API, you'll need to include your API key in the headers of your requests. Here's an example of how to do this using node-fetch:

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

const url = 'https://api.promptchainer.io/api/flows/getFlowInfo/clibnwpno000bmc0k9hvv3y7f';
const apiKey = 'YOUR_API_KEY_HERE';
const headers = {
  'x-api-key': apiKey
};

fetch(url, { headers })
  .then(response => response.json())
  .then(data => console.log(data));

Making Requests

To make a request to the PromptChainer API, you'll need to include your API key in the headers of your requests. Here's an example of how to do this using node-fetch:

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

const url = 'https://api.promptchainer.io/api/flows/getFlowInfo/clibnwpno000bmc0k9hvv3y7f';
const apiKey = 'YOUR_API_KEY_HERE';
const headers = {
  'x-api-key': apiKey
};

fetch(url, { headers })
  .then(response => response.json())
  .then(data => console.log(data));

In this example, we're using node-fetch to make a GET request to the getFlowInfo endpoint of the PromptChainer API. We're passing in the URL of the endpoint and an object containing the headers to be sent with the request. The x-api-key header is set to the API key that you obtained in the Prerequisites section.

You can also make requests to the PromptChainer API using other tools, such as curl or Postman. Here's an example of how to make a request using curl:

bash
curl -X GET \
  'https://api.promptchainer.io/api/flows/getFlowInfo/clibnwpno000bmc0k9hvv3y7f' \
  --header 'x-api-key: YOUR_API_KEY_HERE'

This curl command makes a GET request to the getFlowInfo endpoint of the PromptChainer API. The x-api-key header is set to the API key that you obtained in the Prerequisites section.

The response from the PromptChainer API is in JSON format. Here's an example of what a response might look like:

json
[
  {
    "name": "color",
    "type": "variable"
  },
  {
    "name": "item",
    "type": "variable"
  },
  {
    "name": "image",
    "type": "output"
  },
  {
    "name": "text",
    "type": "output"
  }
]