Probably
Docs

Prepare a script

write_script, in Changes: A connection or key that may make changes. None spends credits; prepare_* and stage tools (research, brainstorm, write_script, review, generate_clip, voice, storyboard) prepare paid work for confirm_spend.

POST
/api/v1/tools/write_script

Prepare a reviewed script for a brief: hook, script by beat, caption and call to action, checked against what the Space already made and judged by the critics. Optionally grounded in a research revision of the same video and opening with hooks you chose: your own lines, or hooks from a brainstorm of the same video by their indexes (a chosen hook is never refused as repeating the brainstorm). Pass lengthSeconds for the length it's paced to and judged against. It runs on a video of the Space (videoId, using that video's brief) or on a new draft made from brief, never both. Metered at cost, at most 90 credits (the preview's capCredits); nothing is spent until it is confirmed. Read the result with get_stage. Show the person the preview. If the connection may spend, call confirm_spend with the confirmationId once they agree; otherwise send them the confirmUrl to confirm it in the studio. It expires in 15 minutes. Pass a new requestKey; repeating one returns the same confirmation.

Authorization

apiKey
headerAuthorizationBearer <token>

An API key (prb_…) from Settings → Connections.

Request Body

application/json
  1. body
spaceId*string
Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
videoId?string

A video of the Space to run on, with its current brief. Don't pass brief, name or attachments with it

Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
brief?string

The brief for a new draft video, when no videoId is given

Length10 <= length <= 20000
name?string
Length1 <= length <= 120
attachments?array<||>
Itemsitems <= 45
requestKey*string
Match^[\w.:-]+$
Length8 <= length <= 64
researchRevisionId?string

A research revision of the same video (get_stage's result) to ground it in

Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
hooks?array<>

Up to three hook lines of your own to open with; the writer uses one, as written or tightened

Itemsitems <= 3
Default[]
chosen?

Hooks chosen from a brainstorm of the same video: its hooks revisionId (get_stage's result) and the hooks' indexes from 0. With hooks, at most three in all

lengthSeconds?number

How long the video runs, which the writer paces the script to and the critics judge it against; without it, the brief's length

Value in15304560

Response Body

The tool's answer.

application/json
  1. response
videoId*string
Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
confirmationId*string
Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
expiresAt*string
preview*||||||
confirmUrl*|null
curl -X POST 'https://studio.probably.co/api/v1/tools/write_script' \  -H "Authorization: Bearer $PROBABLY_API_KEY" \  -H 'Content-Type: application/json' \  -d '{  "spaceId": "5b0e7c1a-3f52-4d8e-9a61-2c4f8e9d7b30",  "videoId": "9c3d5e2f-8a14-4b67-b0d9-6e1f2a3c4d5e",  "attachments": [],  "requestKey": "script-trailguard-1",  "researchRevisionId": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",  "hooks": [],  "chosen": {    "revisionId": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",    "indexes": [      0    ]  },  "lengthSeconds": 30}'
{  "videoId": "9c3d5e2f-8a14-4b67-b0d9-6e1f2a3c4d5e",  "confirmationId": "e7a1b2c3-d4e5-4f60-8172-93a4b5c6d7e8",  "expiresAt": "2026-10-25T09:15:00.000Z",  "preview": {    "kind": "stage",    "stage": "write_script",    "capCredits": 90,    "availableCredits": 1840,    "fits": true,    "clip": null,    "voice": null,    "raw": false,    "storyboard": null,    "sandbox": false  },  "confirmUrl": null}