الانتقال إلى المحتوى الرئيسي
Certyneo
API العام v1

دمّج التوقيع الإلكتروني في مكدس التكنولوجيا الخاص بك

أرسل المغاليف، تابع التوقيعات، استقبل webhooks. API REST بسيط، OpenAPI 3.0، أمثلة curl/Node/Python — كل ما تحتاجه لربط Certyneo بنظام إدارة الموارد البشرية أو CRM أو برنامجك خلال بضع ساعات.

البدء السريع

ثلاث خطوات: أنشئ مفتاح API من الإعدادات، قم بترميز ملف PDF الخاص بك بصيغة base64، أرسله. تحتوي الاستجابة على `signUrl` الذي يمكنك مشاركته مباشرة مع المستقبل.

cURLbash
# 1. Upload the PDF (multipart) and capture the returned document id.
DOC_ID=$(curl -s -X POST https://certyneo.com/api/v1/documents \
  -H "Authorization: Bearer sk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -F "file=@contrat.pdf" | jq -r .id)

# 2. Create a DRAFT envelope referencing the uploaded document.
ENV_ID=$(curl -s -X POST https://certyneo.com/api/v1/envelopes \
  -H "Authorization: Bearer sk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d "{
    \"subject\": \"Contrat de prestation\",
    \"documentIds\": [\"$DOC_ID\"],
    \"recipients\": [
      { \"email\": \"client@example.com\", \"name\": \"Marie Dubois\", \"role\": \"SIGNER\" }
    ]
  }" | jq -r .id)

# 3. Dispatch the envelope — this sends the invitation email/SMS.
curl -X POST https://certyneo.com/api/v1/envelopes/$ENV_ID/send \
  -H "Authorization: Bearer sk_live_xxxxxxxxxxxxxxxxxxxxxxxx"
JavaScript / Nodets
// npm install @certyneo/sdk  (or call fetch directly)
const auth = { Authorization: `Bearer ${process.env.CERTYNEO_API_KEY}` };

// 1. Upload the PDF (multipart).
const fd = new FormData();
fd.append("file", new Blob([pdfBuffer], { type: "application/pdf" }), "contrat.pdf");
const doc = await fetch("https://certyneo.com/api/v1/documents", {
  method: "POST", headers: auth, body: fd,
}).then((r) => r.json());

// 2. Create the DRAFT envelope.
const envelope = await fetch("https://certyneo.com/api/v1/envelopes", {
  method: "POST",
  headers: { ...auth, "Content-Type": "application/json" },
  body: JSON.stringify({
    subject: "Contrat de prestation",
    documentIds: [doc.id],
    recipients: [
      { email: "client@example.com", name: "Marie Dubois", role: "SIGNER" },
    ],
  }),
}).then((r) => r.json());

// 3. Dispatch — this triggers the invitation channel for every recipient.
await fetch(`https://certyneo.com/api/v1/envelopes/${envelope.id}/send`, {
  method: "POST", headers: auth,
});
console.log(envelope.id);
Pythonpython
import os, requests

auth = {"Authorization": f"Bearer {os.environ['CERTYNEO_API_KEY']}"}

# 1. Upload the PDF (multipart).
with open("contrat.pdf", "rb") as f:
    doc = requests.post(
        "https://certyneo.com/api/v1/documents",
        headers=auth,
        files={"file": ("contrat.pdf", f, "application/pdf")},
    ).json()

# 2. Create the DRAFT envelope.
envelope = requests.post(
    "https://certyneo.com/api/v1/envelopes",
    headers={**auth, "Content-Type": "application/json"},
    json={
        "subject": "Contrat de prestation",
        "documentIds": [doc["id"]],
        "recipients": [
            {"email": "client@example.com", "name": "Marie Dubois", "role": "SIGNER"},
        ],
    },
).json()

# 3. Dispatch — this triggers the invitation channel for every recipient.
requests.post(
    f"https://certyneo.com/api/v1/envelopes/{envelope['id']}/send",
    headers=auth,
)
print(envelope["id"])

الأظرف

الإنشاء والإرسال والمراقبة والإلغاء. يمكن للظرف أن يحتوي على عدة مستندات وعدة موقعين (متوازي أو متسلسل).

شبكات الإنترنت

استقبل `envelope.created` و `envelope.completed` و `envelope.declined` على عنوان URL من اختيارك. HMAC SHA-256 على كل حمولة للتحقق من المصدر.

المصادقة البسيطة

Bearer token. مفتاح واحد لكل بيئة (الاختبار / الإنتاج). قابل للإلغاء فوراً. الحد 100 طلب/دقيقة/مفتاح، رفقة 200، 429 نظيفة مع رأس Retry-After.

نقاط النهاية المتاحة

12 مساراً يغطي الدورة الكاملة: الأظرف والمستندات والـ webhooks ومفاتيح API. جميع المسارات تقبل Bearer token وترجع JSON.

MethodPathDescription
GET/api/v1/account/meIdentity of the authenticated caller (id, email, plan) — scope-less credential probe
POST/api/v1/documentsUpload a PDF (multipart) — returns document id
GET/api/v1/documentsList documents
GET/api/v1/documents/{id}Fetch document metadata
DELETE/api/v1/documents/{id}Delete document
GET/api/v1/envelopesList envelopes (filter with ?status= and ?limit=)
POST/api/v1/envelopesCreate envelope (status: DRAFT)
GET/api/v1/envelopes/{id}Fetch envelope state
PATCH/api/v1/envelopes/{id}Update DRAFT envelope
DELETE/api/v1/envelopes/{id}Void / delete DRAFT envelope
POST/api/v1/envelopes/{id}/sendDispatch DRAFT — sends invitations
GET/api/v1/envelopes/{id}/audit-trailDownload eIDAS audit-trail PDF
GET/api/v1/envelopes/{id}/signed-documentDownload signed PDF (once COMPLETED)
GET/api/v1/templatesList reusable envelope templates
GET/api/v1/webhooksList webhooks
POST/api/v1/webhooksRegister webhook — returns the signing secret once
GET/api/v1/webhooks/{id}Fetch webhook subscription
PATCH/api/v1/webhooks/{id}Update url / events / active state
DELETE/api/v1/webhooks/{id}Unregister
POST/api/v1/sealsApply a qualified electronic seal to a document
GET/api/v1/seals/{id}Fetch seal status
GET/api/v1/seals/{id}/certificateDownload the seal certificate
GET/api/v1/keysList API keys
POST/api/v1/keysCreate API key — the secret is shown once
PATCH/api/v1/keys/{id}Rename / revoke key
DELETE/api/v1/keys/{id}Delete key
GET/api/v1/billing/usageCurrent period usage and projected cost
GET/api/v1/statusService status
GET/api/v1/openapiMachine-readable OpenAPI specification

التحقق من الهوية

كل طلب يحتوي على مفتاح API في رأس الطلب Authorization. يتم إنشاؤها من الإعدادات → مفاتيح API ولا تظهر إلا مرة واحدة.

HTTPhttp
GET /api/v1/account/me HTTP/1.1
Host: certyneo.com
Authorization: Bearer sk_live_xxxxxxxxxxxxxxxxxxxxxxxx

# 200 OK
{ "data": { "id": "usr_…", "email": "you@example.com", "plan": "BUSINESS", "environment": "live" } }
  • تنسيق: sk_live_… في الإنتاج، sk_test_… للبيئة التجريبية. رأس: Authorization: Bearer <المفتاح>.
  • النطاقات: التوقيعات، الوثائق، الأحداث الفورية، الشبكات - قراءة (:read) أو كتابة (:write). الكتابة تتطلب القراءة؛ النطاق * يمنح جميع الحقوق.
  • المفاتيح sk_test_ تخلق الموارد في البيئة التجريبية، وهي محصورة ولا تخضع للحد الأقصى أو التسعير.
  • الخطأ: 401 مفتاح غير صالح، 403 نطاق غير كافٍ، 429 حد سرعة متجاوز، 402 الحد الأقصى الشهري تجاوز.

صيغ الرد

نقطة يجب معرفتها قبل كتابة عميلك: المجموعات مُغلَّفة داخل كائن data، في حين تُعاد الموارد الفردية بشكل مباشر. لذا فإن قراءة response.data.data على مورد فردي تُرجع undefined.

المجموعة — مغلقةjson
// GET /api/v1/envelopes
// Collections are WRAPPED in a "data" array.
{
  "data": [
    { "id": "env_abc123", "subject": "Contrat", "status": "SENT" }
  ]
}
وحدة الموارد — مسطحةjson
// GET /api/v1/envelopes/{id}
// Single resources are returned FLAT — no "data" envelope.
{
  "id": "env_abc123",
  "subject": "Contrat",
  "status": "COMPLETED",
  "recipients": [ /* … */ ]
}

حدود معدل النقل

الحدود تضمن جودة خدمة مستقرة لجميع العملاء. إذا كنت بحاجة إلى المزيد، فاتصل بنا.

  • 100 طلب في الدقيقة لكل مفتاح API
  • رفقة مقبولة حتى 200 طلب في أقل من 10 ثوان
  • استجابة 429 مع رأس Retry-After يشير إلى التأخير بالثواني