SURFER_API_KEY (Authentication), an active workspace, and one Content Editor credit, which step 2 spends. A workspace is a brand or site you manage in Surfer, and every request below names one in its URL.
Create and score a Content Editor
1
Pick a workspace
List the active workspaces your key can reach; The Pick an
-g keeps curl from reading the square brackets as a pattern:200 lists each workspace under data. This sample, like every sample on this page, is abridged to the fields the step uses:id from data; the rest of this page uses 123.2
Create a Content Editor
This request spends the Content Editor credit (Rate limits and credits). A Content Editor is the document Surfer builds around one keyword: the guidelines derived from that keyword’s search results, your content, and the scores that grade it. Create one for the keyword Reuse this key when retrying the create; see the idempotency rules.The Keep the
seo tools:201 comes back at once and carries the editor’s current state, scheduled in this example:id (456 here) for the remaining steps. Without location and device, Surfer analyzes the United States search results on mobile; Create Content Editor lists the other fields.3
Wait for the editor to complete
Poll the editor until The Until
state is completed or failed:200 returns the same fields as the create response; once the analysis finishes it reads:state is completed, the endpoints under the editor answer 409; Content Editor states explains each state. On completed, continue. On failed, stop and read error.reason and error.message.4
Read the terms
Read the recommended terms of the completed editor:The Each term says whether it counts toward the SEO score (
200 lists the main keyword first, then the terms Surfer extracted from competitor pages and any custom terms you add:included) and its recommended range of uses (target_range). List SEO Guidelines terms describes every field. Get SEO Guidelines returns terms, structure, competitors, and topics in one large response; the sub-endpoints are the better default.5
Read the score
Read the current SEO score:The Writing content in the next step starts that calculation.
200 carries score (0 to 100), status, and calculated_at, the time of the current score. On a new editor nothing has been scored yet, so score and calculated_at are null and status reads calculating until the first calculation completes:6
Write the content
Send this HTML document with A
Content-Type: text/html and Accept: text/html:204 with no body confirms the write. Document endpoints covers Markdown bodies, the size limit, and how the stored document can differ from what you sent.7
Read the updated score
The write starts a recalculation in the background. Repeat the score request until A completed recalculation returns the new score:
status is ready and calculated_at has changed, with a deadline on the loop (Recognizing a fresh score explains a recalculation that stalls):Next steps
You now have a completed Content Editor with scored content, and every other operation builds on it.- Check what each costs first, then generate an AI Article or run Auto-Optimize on the editor.
- Async operations and webhooks shows how to replace the polling in steps 3 and 7 with webhook events.
- Rate limits and credits covers the per-endpoint request limits.
- Use cases has multi-step recipes built on these requests.