Prerequisites
- Cursor installed
- A Pictory API key from app.pictory.ai/api-access (starts with
pictai_)
Setup
Store your Pictory API key
Add the key to your shell profile (do not commit it):Cursor inherits environment variables from the shell you launched it from. On Windows, use a
.env file at the project root and add .env to .gitignore.Create project rules
Cursor reads
.cursor/rules/*.mdc files automatically. Create the directory and rules file below.Recommended Cursor Rules
Create.cursor/rules/pictory-api.mdc:
OpenAPI as a Tool Schema
Cursor’s Agent mode can ingest an OpenAPI spec as a structured tool. Add this to your rules:Connecting via MCP
To let Cursor’s Agent mode call the Pictory API as a tool (instead of generating code), connect the Pictory MCP server. Setup at Pictory MCP Server.Example Prompts
- “Generate a TypeScript client for the Pictory storyboard render endpoint, using the OpenAPI spec at https://docs.pictory.ai/openapi.json.”
- “Build a React component that lets a user paste a script, choose a language and voice, and submit it to the Pictory render API.”
- “Add error handling for 400 responses to this Pictory integration — surface the validation message to the user.”
- “Refactor my polling loop to use 15-second intervals and exponential backoff capped at 60 seconds.”
Troubleshooting
Cursor Suggests Bearer Authorization
Cursor Suggests Bearer Authorization
Generated Code Returns 400 Validation Errors
Generated Code Returns 400 Validation Errors
Cause: Common causes: missing
videoName, both brandId and brandName included, or invalid language code.Resolution: Paste the API error response back into Cursor — it will adjust. Also confirm your rules file lists the field constraints.`PICTORY_API_KEY` is Undefined at Runtime
`PICTORY_API_KEY` is Undefined at Runtime
Cause: Cursor was launched before the env var was exported in your shell.Resolution: Restart Cursor after sourcing your
.zshrc / .bashrc. On Windows, restart Cursor after setting the env var via System Properties.Next Steps
Use Pictory with an LLM
System prompts, MCP, and example flows
End-to-End Recipes
Ready-to-run JSON payloads
Claude Code Setup
Same setup, for Claude Code users
Windsurf Setup
Same setup, for Windsurf users
