Create an Infographic from a Topic Prompt

Use Python to run the topic-based infographic recipe with outputType: "infographic".

# pip install requests
import os
import requests


def main() -> None:
    token = os.environ.get("AUTOCONTENT_TOKEN", "YOUR_API_TOKEN")
    endpoint = "https://api.autocontentapi.com/content/Create"

    payload = {
        "outputType": "infographic",
        "topic": "How electric vehicle charging networks are expanding in cities",
        "text": "Keep it friendly for city planners and show two key stats plus one map-style callout.",
        "infographicOrientation": "portrait",
        "infographicDetail": "standard",
    }

    response = requests.post(
        endpoint,
        headers={
            "Authorization": f"Bearer {token}",
            "Content-Type": "application/json",
            "Accept": "application/json",
        },
        json=payload,
        timeout=30,
    )
    response.raise_for_status()
    print("Infographic request accepted:", response.json())


if __name__ == "__main__":
    main()

Set YOUR_API_TOKEN (or AUTOCONTENT_TOKEN) before running.

Last updated