Skip to main content

Quickstart

1

Install the SDK

pip install surfacedocs
2

Get your API key

Sign up at app.surfacedocs.dev and create an API key from your dashboard. Keys start with sd_live_.You can pass it directly or set it as an environment variable:
export SURFACEDOCS_API_KEY=sd_live_...
3

Generate and save a document

Choose your LLM provider:
from surfacedocs import SurfaceDocs, DOCUMENT_SCHEMA, SYSTEM_PROMPT
from openai import OpenAI

openai = OpenAI()
docs = SurfaceDocs()

response = openai.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "system", "content": SYSTEM_PROMPT},
        {"role": "user", "content": "Write documentation for user authentication"},
    ],
    response_format={
        "type": "json_schema",
        "json_schema": {"name": "document", "schema": DOCUMENT_SCHEMA},
    },
)

result = docs.save(response.choices[0].message.content)
print(f"Saved: {result.url}")
4

View your document

Open the URL printed in the previous step. Your document is live and shareable at https://app.surfacedocs.dev/d/....

Next steps