واجهة Capycom البرمجية v1
أنشئ الرسائل البريدية وتتبعها من نص برمجي أو n8n أو Make أو خادم MCP. يتم الدفع دائمًا على capycom.ca، من قبل صاحب الحساب: الواجهة البرمجية لا تدفع أبدًا.
أساسيات
- عنوان URL الأساسي:
https://capycom.ca/api/1.1/wf/<nom> - جميع الطلبات هي طلبات POST بصيغة JSON (
Content-Type: application/json). - يوضع المفتاح في الحقل
cleضمن متن الطلب، وليس في الرابط أبدًا. - الاستجابة:
{"status":"success","response":{...}}. الخطأ المتعلق بالعمل يُقابَل أيضًا برمز HTTP 200: تحقق منresponse.statut(okأوerreur). يتضمن الخطأerreur(رمز ثابت)،message(بالإنجليزية) وmessage_fr. - المبالغ بالدولار الكندي قبل الضريبة. تُحسب الضرائب عند إتمام الدفع.
- متن الطلب الذي ليس كائن JSON يُقابَل برمز HTTP 400.
مفتاح الواجهة البرمجية
أنشئ مفتاحك في حسابي، ملفي الشخصي، بطاقة «الوصول إلى الواجهة البرمجية». مفتاح واحد لكل حساب: إنشاء مفتاح جديد يلغي المفتاح القديم. يظهر المفتاح مرة واحدة فقط، ولا تحتفظ Capycom إلا ببصمة منه. يجب تأكيد بريدك الإلكتروني.
دفع ثمن رسالة أُنشئت عبر الواجهة البرمجية
الحقل lien_paiement يؤدي إلى صفحة تسجيل الدخول، ثم إلى ملخص الرسالة: المغلف والمستندات والسعر والدفع. لا يستطيع رؤية هذه الرسالة إلا صاحب حساب المفتاح، لذلك أرسل الرابط إليه. تُحذف المسودة غير المدفوعة تلقائيًا.
api_estimer_prix
Price of a letter before tax, without creating anything. لا حاجة إلى مفتاح.
| الحقل | مطلوب | الوصف |
|---|---|---|
nombre_feuilles | نعم | Number of sheets (whole number, from 1 to the accepted maximum). |
couleur | لا | true for color printing (false by default). |
الاستجابة: statut, nombre_feuilles, couleur, enveloppe, montant_enveloppe, montant_feuilles, nombre_timbres, montant_timbres, total_avant_taxes, devise (CAD). Amounts in dollars.
الأخطاء: 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. المفتاح مطلوب.
| الحقل | مطلوب | الوصف |
|---|---|---|
cle | نعم | Your API key. |
pdf | نعم | Object { "filename": "letter.pdf", "contents": "<base64 PDF>" }. 10 MB max, not password protected. A file URL is not accepted. |
dest_nom | نعم | Recipient's full name or company (80 characters max). |
dest_ligne | نعم | Street number and name. |
dest_appartement | لا | Apartment or unit. |
dest_ville | نعم | City. |
dest_province | نعم | Code (QC, ON...) or French or English name (Québec, Quebec). |
dest_code_postal | نعم | Canadian postal code, A1A 1A1 (space optional). |
exp_nom, exp_ligne, exp_appartement, exp_ville, exp_province, exp_code_postal | نعم | The same fields for the sender (return address). exp_appartement is optional. |
couleur | لا | true for color printing (false by default). |
langue | لا | fr or en (Français or English accepted). Language of the summary page. Default: the account language. |
canal | لا | api, mcp, n8n or make (api by default). Used for statistics. |
cle_idempotence | لا | Text of up to 120 characters. Calling again with the same value returns the same draft instead of creating a second one. |
الاستجابة: 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).
الأخطاء: 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. المفتاح مطلوب.
| الحقل | مطلوب | الوصف |
|---|---|---|
cle | نعم | Your API key. |
id_courrier | نعم | Identifier returned at creation. |
الاستجابة: The same fields as api_creer_courrier.
الأخطاء: 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. المفتاح مطلوب.
| الحقل | مطلوب | الوصف |
|---|---|---|
cle | نعم | Your API key. |
الاستجابة: 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.
الأخطاء: 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. المفتاح مطلوب.
| الحقل | مطلوب | الوصف |
|---|---|---|
cle | نعم | Your API key. |
id_courrier | نعم | Identifier of the draft. |
الاستجابة: statut, id_courrier, statut_courrier (annule), message, message_fr.
الأخطاء: 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"}'رموز الأخطاء
| الرمز | المعنى |
|---|---|
cle_invalide | المفتاح مفقود أو غير معروف أو ملغى (المفتاح الجديد يحل محل القديم). |
quota_atteint | أكثر من 20 رسالة أُنشئت عبر الواجهة البرمجية خلال 24 ساعة في هذا الحساب. |
code_postal_invalide | رمز بريدي كندي غير صالح للمستلم أو المرسل. |
province_invalide | مقاطعة أو إقليم غير معروف (كندا فقط). |
adresse_invalide | الاسم أو الشارع أو المدينة فارغ أو طويل جدًا. تذكر الرسالة اسم الحقل. |
pdf_invalide | ملف PDF مفقود أو غير مقروء أو محمي أو أكبر من 10 ميغابايت أو أطول من 30 ورقة. |
nombre_feuilles_invalide | عدد الأوراق ليس عددًا صحيحًا بين 1 و30. |
introuvable | لا توجد رسالة في هذا الحساب بهذا المعرّف (وكذلك إذا كانت الرسالة تخص حسابًا آخر). |
non_annulable | لم تعد الرسالة مسودة: فهي مدفوعة أو قيد المعالجة. |
{
"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"
}التوافق
تحتفظ نقاط الوصول هذه بأسماء واجهة Capycom البرمجية السابقة وحقولها واستجاباتها. وتستجيب العناوين نفسها أيضًا تحت /version-test/api/1.1/wf/.
خادم MCP الخاص بـ Capycom (https://mcp.capycom.ca/mcp) هذه الواجهة. رمزها المصدري متاح للجميع: https://github.com/Adel-11/Capycom.