Skip to main content

Authorization

All Predis.ai API enpoints require a valid API Key authorization to get successful responses. Developers can sign up to Predis.ai to request an API key.

Get an API Key

Follow the steps below to generate an API key:

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

Making Requests

Once you have the API key, all requests to the API endpoints should include the key in the Authorization header.

Below is a quick Python example that shows how to include the Authorization header while making requests:

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)

If you include an invalid API key in the headers, you will get a response with HTTP status code 401 along with the details of the error. If you have any questions, feel free to contact us at [email protected]

Additional Resources