Capycom
Log inSign up
← Send a letter from an AI

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 cle field of the body, never in the URL.
  • Response: {"status":"success","response":{...}}. A business error also answers HTTP 200: check response.statut (ok or erreur). An error contains erreur (stable code), message (English) and message_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.

FieldRequiredDescription
nombre_feuillesyesNumber of sheets (whole number, from 1 to the accepted maximum).
couleurnotrue 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.

FieldRequiredDescription
cleyesYour API key.
pdfyesObject { "filename": "letter.pdf", "contents": "<base64 PDF>" }. 10 MB max, not password protected. A file URL is not accepted.
dest_nomyesRecipient's full name or company (80 characters max).
dest_ligneyesStreet number and name.
dest_appartementnoApartment or unit.
dest_villeyesCity.
dest_provinceyesCode (QC, ON...) or French or English name (Québec, Quebec).
dest_code_postalyesCanadian postal code, A1A 1A1 (space optional).
exp_nom, exp_ligne, exp_appartement, exp_ville, exp_province, exp_code_postalyesThe same fields for the sender (return address). exp_appartement is optional.
couleurnotrue for color printing (false by default).
languenofr or en (Français or English accepted). Language of the summary page. Default: the account language.
canalnoapi, mcp, n8n or make (api by default). Used for statistics.
cle_idempotencenoText 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.

FieldRequiredDescription
cleyesYour API key.
id_courrieryesIdentifier 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.

FieldRequiredDescription
cleyesYour 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.

FieldRequiredDescription
cleyesYour API key.
id_courrieryesIdentifier 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

CodeMeaning
cle_invalideKey missing, unknown or revoked (a new key replaces the old one).
quota_atteintMore than 20 letters created through the API in 24 hours on this account.
code_postal_invalideInvalid Canadian postal code for the recipient or the sender.
province_invalideUnknown province or territory (Canada only).
adresse_invalideName, street or city empty or too long. The message names the field.
pdf_invalidePDF missing, unreadable, protected, larger than 10 MB or longer than 30 sheets.
nombre_feuilles_invalideNumber of sheets that is not a whole number between 1 and 30.
introuvableNo letter of this account with this identifier (also for another account's letter).
non_annulableThe 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.