Ontwikkelaars

SpeakNotes API quickstart

Maak een sleutel aan, doe je eerste aanroep in de sandbox en schakel daarna over naar live. Vier stappen, allemaal in curl.

1. Maak een sleutel aan

Open Instellingen, API-sleutels en maak er een aan. Kies sandbox terwijl je aan het bouwen bent: sandbox-sleutels geven vaste output terug, verbruiken geen credits en schrijven naar een aparte bibliotheek die je kunt verwijderen.

2. Vat iets samen in de sandbox

Elke route werkt met een sandbox-sleutel. De vorm van het antwoord is identiek aan live, dus je kunt er met vertrouwen tegenaan bouwen.

curl -X POST https://api.speaknotes.io/v1/summaries \
  -H "Authorization: Bearer sn_test_YOUR_SANDBOX_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "We agreed to ship the billing fix on Friday. Sam owns the migration.",
    "styleId": "meeting-notes"
  }'

# {
#   "title": "Sandbox meeting notes",
#   "summary": "## Decisions\n- Sandbox mode confirmed working ...",
#   "styleId": "meeting-notes",
#   "creditsCharged": 0,
#   "notice": "Sandbox response: fixed output, no credits charged."
# }

3. Schakel over naar een live-sleutel

Zelfde verzoek, andere sleutel. Deze voert het echte model uit en brengt credits in rekening, en het antwoord vertelt je hoeveel er zijn gebruikt en hoeveel er nog over zijn.

curl -X POST https://api.speaknotes.io/v1/summaries \
  -H "Authorization: Bearer sn_live_YOUR_LIVE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "...", "styleId": "meeting-notes"}'

# Response headers include:
#   X-Credits-Remaining: 1998
# Response body includes:
#   "creditsCharged": 2

4. Upload een bestand

Langere media wordt op de achtergrond verwerkt. Maak de upload aan, zet het bestand met PUT naar de ondertekende URL, markeer het als voltooid en pols de notitie totdat de status Done is.

# 1. create the note and get a signed upload URL
curl -X POST https://api.speaknotes.io/v1/uploads \
  -H "Authorization: Bearer $SPEAKNOTES_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"fileName": "standup.m4a", "contentType": "audio/mp4", "styleId": "meeting-notes"}'

# 2. upload the file straight to the signed URL
curl -X PUT "$UPLOAD_URL" -H "Content-Type: audio/mp4" --data-binary @standup.m4a

# 3. tell SpeakNotes the upload finished (this is where credits are charged)
curl -X POST https://api.speaknotes.io/v1/uploads/$NOTE_ID/complete \
  -H "Authorization: Bearer $SPEAKNOTES_API_KEY"

# 4. poll until status is Done, then read the note
curl https://api.speaknotes.io/v1/notes/$NOTE_ID/status \
  -H "Authorization: Bearer $SPEAKNOTES_API_KEY"

curl https://api.speaknotes.io/v1/notes/$NOTE_ID \
  -H "Authorization: Bearer $SPEAKNOTES_API_KEY"

De API ontdekken

GET /v1 heeft geen credential nodig en geeft de resources, scopes, rate limits, creditkosten en instructies voor authenticatie terug. Het is de snelste manier voor een agent om zich te oriënteren.

curl https://api.speaknotes.io/v1

# Returns the resources, scopes, rate limits, credit costs,
# and how to authenticate. No credential required.

Volgende: authenticatie en scopes, de foutcodes en wat elke operatie kost.