Quickstart / Python

Use GetMD without waiting for an SDK release.

The example uses only Python standard-library modules and keeps the credential in the process environment.

Create the job

Use an HTTPS endpoint and a unique idempotency key for each new intent.

quickstart.pypython
import json, os, uuid
from urllib.request import Request, urlopen

token = os.environ['GETMD_API_KEY']
body = {
  "source": {
    "type": "text",
    "content": "The Acorn API v2 adds cursor pagination. Existing v1 endpoints remain supported through 2027.",
    "title": "Original release note"
  },
  "output": {
    "profile": "agent_context",
    "format": "markdown",
    "language": "en",
    "include_raw_source": false
  },
  "retention": {
    "class": "temporary"
  }
}
request = Request('https://api.getmd.xyz/v1/jobs', data=json.dumps(body).encode(), method='POST', headers={
    'Authorization': 'Bearer ' + token,
    'Content-Type': 'application/json',
    'Idempotency-Key': str(uuid.uuid4()),
})
with urlopen(request, timeout=30) as response:
    job = json.load(response)
print(job['id'], job['status'])

Continue by identifier

GET the job until terminal, list its outputs, then read output content. Treat HTTP 429 as a signal to wait for Retry-After.

  • Set a total deadline.
  • Do not retry 401 or 403 in a loop.
  • Persist the job ID before polling.

Boundaries

The example uses original text, temporary retention, one output, and bounded reads. Inspect warnings and expiry before handing the result to another system.