Capycom API v1
Create and track postal letters from a script, n8n, Make or an MCP server. Payment always happens on capycom.ca, by the account holder: the API never pays.
Basics
- Base URL:
https://capycom.ca/api/1.1/wf/<nom> - All requests are JSON POSTs (
Content-Type: application/json). - The key goes in the
clefield of the body, never in the URL. - Response:
{"status":"success","response":{...}}. A business error also answers HTTP 200: checkresponse.statut(okorerreur). An error containserreur(stable code),message(English) andmessage_fr. - Amounts in Canadian dollars, before tax. Taxes are calculated at checkout.
- A body that is not a JSON object gets HTTP 400.
API key
Create your key in My account, My profile, "API access" card. One key per account: generating a new one revokes the old one. The key is shown only once; Capycom only keeps a fingerprint of it. Your e-mail must be confirmed.
Paying for a letter created through the API
The lien_paiement field leads to the login page, then to the letter's summary: envelope, documents, price and payment. Only the holder of the key's account can see this letter: send the link to them. An unpaid draft is deleted automatically.
api_estimer_prix
Price of a letter before tax, without creating anything. No key needed.
| Field | Required | Description |
|---|---|---|
nombre_feuilles | yes | Number of sheets (whole number, from 1 to the accepted maximum). |
couleur | no | true for color printing (false by default). |
Response: statut, nombre_feuilles, couleur, enveloppe, montant_enveloppe, montant_feuilles, nombre_timbres, montant_timbres, total_avant_taxes, devise (CAD). Amounts in dollars.
Errors: nombre_feuilles_invalide
curl -X POST https://capycom.ca/api/1.1/wf/api_estimer_prix \
-H 'Content-Type: application/json' \
-d '{"nombre_feuilles": 1, "couleur": false}'{
"response": {
"couleur": false,
"devise": "CAD",
"enveloppe": "Petite",
"montant_enveloppe": 1.0,
"montant_feuilles": 0.8,
"montant_timbres": 1.56,
"nombre_feuilles": 1,
"nombre_timbres": 1,
"statut": "ok",
"total_avant_taxes": 3.36
},
"status": "success"
}api_creer_courrier
Creates a draft on the key holder's account from a PDF and two addresses, and returns the price and the payment link. Nothing is printed before the account holder pays. Key required.
| Field | Required | Description |
|---|---|---|
cle | yes | Your API key. |
pdf | yes | Object { "filename": "letter.pdf", "contents": "<base64 PDF>" }. 10 MB max, not password protected. A file URL is not accepted. |
dest_nom | yes | Recipient's full name or company (80 characters max). |
dest_ligne | yes | Street number and name. |
dest_appartement | no | Apartment or unit. |
dest_ville | yes | City. |
dest_province | yes | Code (QC, ON...) or French or English name (Québec, Quebec). |
dest_code_postal | yes | Canadian postal code, A1A 1A1 (space optional). |
exp_nom, exp_ligne, exp_appartement, exp_ville, exp_province, exp_code_postal | yes | The same fields for the sender (return address). exp_appartement is optional. |
couleur | no | true for color printing (false by default). |
langue | no | fr or en (Français or English accepted). Language of the summary page. Default: the account language. |
canal | no | api, mcp, n8n or make (api by default). Used for statistics. |
cle_idempotence | no | Text of up to 120 characters. Calling again with the same value returns the same draft instead of creating a second one. |
Response: statut, id_courrier, statut_courrier, reference (empty until the letter is paid), canal, nombre_feuilles (counted in the PDF), couleur, enveloppe, amounts, total_avant_taxes, devise, destinataire and expediteur (multi-line text), lien_paiement (and lien_paiement_test, identical).
Errors: cle_invalide, quota_atteint, code_postal_invalide, province_invalide, adresse_invalide, pdf_invalide
PDF64=$(base64 -w0 lettre.pdf)
curl -X POST https://capycom.ca/api/1.1/wf/api_creer_courrier \
-H 'Content-Type: application/json' \
-d '{"cle": "capy_VOTRE_CLE",
"pdf": {"filename": "lettre.pdf", "contents": "'"$PDF64"'"},
"dest_nom": "Entreprise Exemple", "dest_ligne": "100 rue Exemple",
"dest_ville": "Ottawa", "dest_province": "Ontario", "dest_code_postal": "K1A 0A1",
"exp_nom": "Marie Roy", "exp_ligne": "234 Rideau Street", "exp_appartement": "12",
"exp_ville": "Ottawa", "exp_province": "ON", "exp_code_postal": "K1N 0A9",
"langue": "fr", "cle_idempotence": "commande-0001"}'api_statut_courrier
Status, price and addresses of one letter of the account. Key required.
| Field | Required | Description |
|---|---|---|
cle | yes | Your API key. |
id_courrier | yes | Identifier returned at creation. |
Response: The same fields as api_creer_courrier.
Errors: cle_invalide, introuvable
curl -X POST https://capycom.ca/api/1.1/wf/api_statut_courrier \
-H 'Content-Type: application/json' \
-d '{"cle": "capy_VOTRE_CLE", "id_courrier": "3f6c2a9e-0000-0000-0000-000000000000"}'api_lister_courriers
The account's five most recent letters. Key required.
| Field | Required | Description |
|---|---|---|
cle | yes | Your API key. |
Response: statut, total_courriers, then five fixed slots courrier_1_* to courrier_5_*: id, statut, reference, canal, total_avant_taxes. An empty slot has an empty id.
Errors: cle_invalide
curl -X POST https://capycom.ca/api/1.1/wf/api_lister_courriers \
-H 'Content-Type: application/json' \
-d '{"cle": "capy_VOTRE_CLE"}'api_annuler_brouillon
Cancels a draft: it is deleted right away with its pages and PDF files. Key required.
| Field | Required | Description |
|---|---|---|
cle | yes | Your API key. |
id_courrier | yes | Identifier of the draft. |
Response: statut, id_courrier, statut_courrier (annule), message, message_fr.
Errors: cle_invalide, introuvable, non_annulable
curl -X POST https://capycom.ca/api/1.1/wf/api_annuler_brouillon \
-H 'Content-Type: application/json' \
-d '{"cle": "capy_VOTRE_CLE", "id_courrier": "3f6c2a9e-0000-0000-0000-000000000000"}'Error codes
| Code | Meaning |
|---|---|
cle_invalide | Key missing, unknown or revoked (a new key replaces the old one). |
quota_atteint | More than 20 letters created through the API in 24 hours on this account. |
code_postal_invalide | Invalid Canadian postal code for the recipient or the sender. |
province_invalide | Unknown province or territory (Canada only). |
adresse_invalide | Name, street or city empty or too long. The message names the field. |
pdf_invalide | PDF missing, unreadable, protected, larger than 10 MB or longer than 30 sheets. |
nombre_feuilles_invalide | Number of sheets that is not a whole number between 1 and 30. |
introuvable | No letter of this account with this identifier (also for another account's letter). |
non_annulable | The letter is no longer a draft: it is paid or being processed. |
{
"response": {
"erreur": "cle_invalide",
"message": "API key missing, unknown or revoked.",
"message_fr": "Clé API absente, inconnue ou révoquée.",
"statut": "erreur"
},
"status": "success"
}Compatibility
These endpoints keep the names, fields and responses of the former Capycom API. The same addresses also answer under /version-test/api/1.1/wf/.
Capycom's MCP server (https://mcp.capycom.ca/mcp) uses this API. Its code is public: https://github.com/Adel-11/Capycom.