1Get your API key
In the portal, open Users, then API keys, and press New key. Give it a name and press Copy.
You can limit a key to some extensions: Only these or All except these. Leave the list empty to allow every extension. Switch on Include sub-extensions and an extension in the list also covers everything under it.
2Send the key with every call
Add this header. Put your key in place of YOUR_KEY.
Authorization: Bearer YOUR_KEY
3See your extensions
This lists every extension your key may use. Each has an extension_id:
the same Extension ID number you see in the portal.
curl -H "Authorization: Bearer YOUR_KEY" \
https://api.chotline.com/v1/extensions
| extension_id | The number you upload to, like 40566 |
| name | The extension's name |
| path | The keys a caller presses to get there, like 2/4/0 |
| type | What it does: menu, playback, voicemail... |
| active | Whether it is switched on |
| recordings | How many recordings it plays now |
4Upload a recording
Send the audio file to the extension's number. Here it goes to extension 40566.
curl -H "Authorization: Bearer YOUR_KEY" \
-F "file=@shiur.mp3" \
https://api.chotline.com/v1/extensions/40566/recordings
Want it at a set number in the list? Add -F "number=5". Without it, it goes on top.
5Check that it's ready
The upload answers with an upload_id. Ask about it until status says ready, usually a few seconds.
curl -H "Authorization: Bearer YOUR_KEY" \
https://api.chotline.com/v1/uploads/UPLOAD_ID
| queued | Waiting its turn |
| processing | Being converted |
| ready | Done - callers can hear it |
| failed | error says why |
?If something goes wrong
| 401 | The key is missing or wrong. Copy it again from the Users page. |
| 403 | This key may not use that extension. Check its list on the Users page. |
| 404 | No extension has that number. |
| 409 | The account is out of space. Empty Trash or ask for more. |
| 413 / 415 | The file is too big, too long, or not audio. |