Skip to main content

Quick Start

The Predis.ai API allows developers programmatic access to the Predis.ai's content creation flow. The API is a RESTful JSON API with which you can interact from any language or framework with a HTTP library.

If you have any questions, feel free to contact us at [email protected].

Step 1: Sign up to get an API Key

You need an API key to use the Predis.ai API.

  • Login to app.predis.ai
  • Navigate to My account -> Rest API to generate a new API key

Step 2: Configure Webhook

You will also need to configure a webhook to get notifications on your app when the posts get created successfully (or if they fail). Once the post creation succeeds or fails, we will send a POST request on your configured URL.

  • Navigate to My account -> Rest API to add your webhook URL

Step 3: Get Your Brand ID

All your posts created from the Predis app reside in a particular Brand. The same concept applies to the posts created via API too. You will need to pass a brand ID in the post creation request so that the posts get created in the appropriate brand. Read more about Brands here.

  • Navigate to My Account -> Brands to get your brand ID

Step 4: Create Posts

You are now ready to create posts programmatically using Predis.ai's content creation API. Below is a quick example that shows how the API call can be implemented in Python using the requests library.

Example

import requests

url = "https://brain.predis.ai/predis_api/v1/create_content/"

payload = {
"brand_id": "YOUR_BRAND_ID",
"text": "3 tips for a healthy morning breakfast",
"media_type": "single_image"
}

headers = {"Authorization": "YOUR_API_KEY"}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
# {
# "post_ids": [
# "CREATED_POST_ID"
# ],
# "post_status": "inProgress",
# "errors": []
# }

On a successful request, you should see a response as above with the details about the created post. Once the post has some status - success or failure - you should get a request on your webhook url with more details. Read more about the response parameters here and the webhook request parameters here

Additional Resources