Skip to main content
You need an API key stored in an environment variable named 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; -g keeps curl from reading the square brackets as a pattern:
The 200 lists each workspace under data. This sample, like every sample on this page, is abridged to the fields the step uses:
Pick an 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 seo tools:
Reuse this key when retrying the create; see the idempotency rules.The 201 comes back at once and carries the editor’s current state, scheduled in this example:
Keep the 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 state is completed or failed:
The 200 returns the same fields as the create response; once the analysis finishes it reads:
Until 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 200 lists the main keyword first, then the terms Surfer extracted from competitor pages and any custom terms you add:
Each term says whether it counts toward the SEO score (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 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:
Writing content in the next step starts that calculation.
6

Write the content

Send this HTML document with Content-Type: text/html and Accept: text/html:
A 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 status is ready and calculated_at has changed, with a deadline on the loop (Recognizing a fresh score explains a recalculation that stalls):
A completed recalculation returns the new score:

Next steps

You now have a completed Content Editor with scored content, and every other operation builds on it.