For the complete documentation index, see llms.txt. This page is also available as Markdown.

Full client script example

Full runnable Perceptis API v1 client script.

Use the Python script on this page to start a generation job, poll until it finishes, and print the PowerPoint download URLs. It works for single-slide generation, deck generation, or both in one run.

The script handles the details that production callers should care about:

  • It sends POST /api/v1/generate with an Idempotency-Key.

  • It polls GET /api/v1/status/{job_id} with backoff.

  • It honors Retry-After when the API asks the client to slow down.

  • It prints timestamps, job IDs, status changes, and final download URLs.

  • It leaves web search and knowledge base use off unless you enable them.

Environment

Set the API origin and your API key:

export PERCEPTIS_API_BASE_URL="https://app.perceptis.ai"
export PERCEPTIS_API_KEY="sk-live-per-..."

PERCEPTIS_API_BASE_URL should be the origin only. Do not include /api/v1; the script adds the API paths.

Run The Script

Generate both a single slide and a deck:

python3 generate_and_poll.py --mode both

Generate only a single slide:

Generate only a deck:

Generate a single slide from a local reference image:

Enable web search or knowledge base context only when you want those sources included:

Safe retries

--idempotency-key and job_id have different roles:

  • --idempotency-key is sent when creating a job. Reuse it with the same request body if you need to retry after a timeout or network error; Perceptis returns the original job instead of creating a duplicate.

  • job_id is returned by Perceptis after the job is accepted. Use it to poll status and refresh download links.

If you omit --idempotency-key, the script generates one for the run. When --mode both is used, it derives separate keys for the single-slide and deck jobs.

Completed jobs can be polled again for fresh download links while the generated files remain available. Use the same API key that created the job.

Full reference script

Use this as generate_and_poll.py:

Last updated

Was this helpful?