ID PhotoREST · JSONOpenAPI 3.1

SVOYAGER ID Photo API

حوّل أي صورة إلى صورة متوافقة مع متطلبات بطاقة الهوية / جواز السفر / التأشيرة.

نظرة عامة

ما الذي يفعله

تعمل SVOYAGER ID Photo API على تحويل صورة شخصية عادية إلى صورة وثائقية متوافقة مع المعايير. ID Photo هو منتج واحد: حيث يتم تمثيل جواز السفر والتأشيرة وتصريح الإقامة والهوية الوطنية كمواصفات وثائقية، وليست منتجات منفصلة. يمكنك تحميل صورة، وإنشاء معاينة بعلامة مائية وفقًا لمواصفات معينة، ثم إتمام العملية للحصول على النتيجة الخالية من العلامة المائية.

معاينة → سير العمل النهائي

  1. 1قم بتحميل صورة. قم بإنشاء وجهة تحميل وأرسل بايتات الصورة إليها.
  2. 2إنشاء جلسة عمل. اعرض معاينة بعلامة مائية وفقًا للمواصفات. راجع المشكلات التي تم الإبلاغ عنها.
  3. 3الإنهاء. حوّل الجلسة التي تمت مراجعتها إلى طلب واحصل على النسخة النهائية الخالية من العلامة المائية.

البدء السريع

يتم توثيق كل طلب باستخدام مفتاح سري من نوع Bearer. ابدأ في وضع الاختبار:

curl
# List specifications to find a spec_id
curl -G "https://partner.svoyager.com/v1/photo-specifications" \
  -H "Authorization: Bearer svoy_sk_test_YOUR_KEY" \
  --data-urlencode "country=US"

عنوان URL الأساسي والبيئات

يتم تقديم جميع نقاط النهاية عبر عنوان URL أساسي واحد:

Base URL
https://partner.svoyager.com/v1

لا يوجد مسار أو معلمة للبيئة. ويتم تحديد ما إذا كان الطلب يعمل في بيئة الاختبار أم البيئة الحية بشكل كامل من خلال بادئة مفتاح API الخاص بك (svoy_sk_test_… مقابل svoy_sk_live_…). وتكرر الاستجابات ذلك على أنه livemode.

المصادقة

مفاتيح API

قم بالمصادقة على كل طلب باستخدام رأس «Authorization» الذي يحمل مفتاحك السري. يتم إنشاء المفاتيح وتبديلها في «Partner Center».

Header
Authorization: Bearer svoy_sk_test_R2p9Kx7YOURKEYHERExxxxxxx

تحدد البادئة البيئة: svoy_sk_test_… للاختبار، و svoy_sk_live_… للإنتاج. لا يمكن لمفتاح الاختبار أبدًا العمل على بيانات الإنتاج (والعكس صحيح) — وتؤدي حالات عدم التطابق إلى إرجاع الرمز 401 wrong_environment.

النطاقات

تحمل المفاتيح نطاقات صريحة ذات أقل الامتيازات. أي طلب يفتقد النطاق المطلوب يُرجع الرمز 403 insufficient_scope.

النطاقالمنح
photo.specs.readList and retrieve photo specifications.
photo.sessions.readRetrieve sessions and their previews.
photo.sessions.writeCreate uploads and photo sessions (previews).
photo.finalize.writeFinalize a session into a no-watermark order.
photo.orders.readRetrieve orders and download finals.

الحفاظ على أمان المفاتيح

المفاتيح السرية مخصصة للاستخدام بين الخوادم فقط. لا تقم أبدًا بتضمين مفتاح سري في كود المتصفح أو الجوال، أو في مستودع عام، أو في حزمة من جانب العميل. إذا تم الكشف عن مفتاح ما، فقم بتغييره على الفور في «مركز الشركاء».

واجهة برمجة التطبيقات الأساسية

نقاط النهاية

يتم تمييز الحقول الإلزامية بعلامة *. تستخدم الأمثلة بيانات اعتماد مؤقتة — ولا تستخدم أبدًا مفاتيح حقيقية.

POST/v1/uploads

Upload a photo

Create a short-lived presigned upload target, then PUT the raw image bytes straight to `upload_url`. This bypasses request-body size limits (product cap 10 MB). No quota is spent.

النطاق photo.sessions.write
الطلب
النص الأساسي (application/json)
الحقلالنوعالوصف
content_type*stringMIME type of the image.image/jpegimage/pngimage/webpimage/heic
  • `upload_url` is single-use and expires; upload promptly and do not modify the URL.
مثال على الطلب
curl
# 1) Create the upload target
curl -X POST "https://partner.svoyager.com/v1/uploads" \
  -H "Authorization: Bearer svoy_sk_test_R2p9Kx7YOURKEYHERExxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"content_type":"image/jpeg"}'

# 2) PUT the bytes to the returned upload_url (exactly as returned)
curl -X PUT "$UPLOAD_URL" \
  -H "Content-Type: image/jpeg" \
  --data-binary @photo.jpg
الاستجابة · 201
201 · application/json
{
  "object": "upload",
  "upload_url": "https://upload.svoyager.com/v1/EXAMPLE?signature=…",
  "upload_ref": "up_ref_tXk3W2b8Qe7Ra1Nc0",
  "max_bytes": 10485760,
  "expires_at": "2026-07-24T18: 20: 00Z"
}
الأخطاء
الحالةالكودعندما
400missing_content_type`content_type` was not provided.
415unsupported_formatThe content type is not an accepted image format.
503temporarily_unavailableUploads are temporarily unavailable.
502upload_init_failedThe upload could not be initialised — retry shortly.

بالإضافة إلى أخطاء المصادقة والأذونات وحدود المعدل القياسية — انظر الأخطاء وإعادة المحاولة.

POST/v1/photo-sessions

Create a photo session

Generate a watermarked preview from an upload against a specification. Spends one `preview` unit of your plan. Review `issues` before finalizing.

النطاق photo.sessions.write مطلوب Idempotency-Key
الطلب
النص الأساسي (application/json)
الحقلالنوعالوصف
upload_ref*stringThe `upload_ref` from Upload a photo.
spec_id*stringThe `photo_specification` id (`spc_…`) to render against.
مثال على الطلب
curl
curl -X POST "https://partner.svoyager.com/v1/photo-sessions" \
  -H "Authorization: Bearer svoy_sk_test_R2p9Kx7YOURKEYHERExxxxxxx" \
  -H "Idempotency-Key: a7f3c9e1-2b4d-4c8a-9f10-3e5d6b7a8c9d" \
  -H "Content-Type: application/json" \
  -d '{"upload_ref":"up_ref_tXk3W2b8Qe7Ra1Nc0","spec_id":"spc_9wTv2c1Kd8Qe"}'
الاستجابة · 201
201 · application/json
{
  "object": "photo_session",
  "id": "3f9c1e77-2b8a-4a1e-9d2c-6b5a4c3d2e10",
  "livemode": false,
  "status": "preview_ready",
  "spec_id": "spc_9wTv2c1Kd8Qe",
  "preview_url": "https://partner.svoyager.com/v1/photo-sessions/3f9c1e77-2b8a-4a1e-9d2c-6b5a4c3d2e10/preview",
  "watermarked": true,
  "issues": [],
  "created_at": "2026-07-24T18: 30: 00Z"
}
الأخطاء
الحالةالكودعندما
400missing_idempotency_keyThe `Idempotency-Key` header is missing.
400missing_upload_ref`upload_ref` is missing.
400missing_spec_id`spec_id` is missing.
400invalid_upload_refThe referenced upload could not be read.
413file_too_largeThe uploaded file exceeds 10 MB.
415unsupported_formatThe uploaded file is not an accepted image format.
404spec_not_foundNo active specification matches `spec_id`.
402no_active_planNo active plan is assigned for this environment.
402quota_exceededIncluded preview quota for the period is exhausted.
402plan_inactiveThe plan is not active for this environment.
409idempotency_key_reuseThe key was reused with a different body.
409request_in_progressA request with this key is still processing.
422unprocessable_imageThe image could not be processed.
502provider_errorThe preview could not be generated upstream — retry shortly.
503provider_busyThe processing service is busy — retry shortly.

بالإضافة إلى أخطاء المصادقة والأذونات وحدود المعدل القياسية — انظر الأخطاء وإعادة المحاولة.

GET/v1/photo-sessions/{id}

Retrieve a photo session

Fetch a session by id, including its current status, `preview_url`, and any `issues`.

النطاق photo.sessions.read
الطلب
معلمات المسار
الحقلالنوعالوصف
id*stringSession id.
مثال على الطلب
curl
curl "https://partner.svoyager.com/v1/photo-sessions/3f9c1e77-2b8a-4a1e-9d2c-6b5a4c3d2e10" \
  -H "Authorization: Bearer svoy_sk_test_R2p9Kx7YOURKEYHERExxxxxxx"
الاستجابة · 200
200 · application/json
{
  "object": "photo_session",
  "id": "3f9c1e77-2b8a-4a1e-9d2c-6b5a4c3d2e10",
  "livemode": false,
  "status": "preview_ready",
  "spec_id": "spc_9wTv2c1Kd8Qe",
  "preview_url": "https://partner.svoyager.com/v1/photo-sessions/3f9c1e77-2b8a-4a1e-9d2c-6b5a4c3d2e10/preview",
  "watermarked": true,
  "issues": [],
  "created_at": "2026-07-24T18: 30: 00Z"
}
الأخطاء
الحالةالكودعندما
404session_not_foundNo session matches the id for this account/environment.

بالإضافة إلى أخطاء المصادقة والأذونات وحدود المعدل القياسية — انظر الأخطاء وإعادة المحاولة.

GET/v1/photo-sessions/{id}/preview

Download the preview image

Stream the watermarked preview image bytes for a session (SVOYAGER-hosted; the upstream URL is never exposed). This is the resource `preview_url` points to.

النطاق photo.sessions.readتُرجع بايتات الصورة
الطلب
معلمات المسار
الحقلالنوعالوصف
id*stringSession id.
  • Returns raw `image/*` bytes on success (not JSON).
مثال على الطلب
curl
curl "https://partner.svoyager.com/v1/photo-sessions/3f9c1e77-2b8a-4a1e-9d2c-6b5a4c3d2e10/preview" \
  -H "Authorization: Bearer svoy_sk_test_R2p9Kx7YOURKEYHERExxxxxxx" \
  --output preview.jpg
الاستجابة · 200

في حالة النجاح، تقوم نقطة النهاية ببث بايتات الصورة الخام (وليس JSON). احفظ نص الاستجابة في ملف.

الأخطاء
الحالةالكودعندما
404preview_not_foundThe session or its preview does not exist.

بالإضافة إلى أخطاء المصادقة والأذونات وحدود المعدل القياسية — انظر الأخطاء وإعادة المحاولة.

POST/v1/photo-sessions/{id}/finalize

Finalize a photo

Turn a reviewed session into a deliverable order. In live mode this produces the no-watermark final and spends one `final` unit; in test mode it emulates the final from the preview.

النطاق photo.finalize.write مطلوب Idempotency-Key
الطلب
معلمات المسار
الحقلالنوعالوصف
id*stringSession id to finalize.
مثال على الطلب
curl
curl -X POST "https://partner.svoyager.com/v1/photo-sessions/3f9c1e77-2b8a-4a1e-9d2c-6b5a4c3d2e10/finalize" \
  -H "Authorization: Bearer svoy_sk_live_A8m4Qz1YOURKEYHERExxxxxxx" \
  -H "Idempotency-Key: a7f3c9e1-2b4d-4c8a-9f10-3e5d6b7a8c9d"
الاستجابة · 201Returns 200 with the existing order if the session was already finalized (never double-charged).
201 · application/json
{
  "object": "photo_order",
  "id": "8a2d5b40-71c6-4f0e-b3a9-1e7c9d05f284",
  "livemode": true,
  "sandbox_emulated": false,
  "status": "final_ready",
  "session_id": "3f9c1e77-2b8a-4a1e-9d2c-6b5a4c3d2e10",
  "spec_id": "spc_9wTv2c1Kd8Qe",
  "final_url": "https://partner.svoyager.com/v1/orders/8a2d5b40-71c6-4f0e-b3a9-1e7c9d05f284/final",
  "watermarked": false,
  "created_at": "2026-07-24T18: 31: 00Z"
}
الأخطاء
الحالةالكودعندما
400missing_idempotency_keyThe `Idempotency-Key` header is missing.
404session_not_foundNo session matches the id for this account/environment.
422session_not_finalizableThe session is not in a finalizable state.
402no_active_planNo active plan is assigned for this environment.
402quota_exceededIncluded final quota for the period is exhausted.
402plan_inactiveThe plan is not active for this environment.
409idempotency_key_reuseThe key was reused with a different request.
409request_in_progressA request with this key is still processing.
502provider_errorThe final could not be produced upstream — retry shortly.
503provider_busyThe processing service is busy — retry shortly.

بالإضافة إلى أخطاء المصادقة والأذونات وحدود المعدل القياسية — انظر الأخطاء وإعادة المحاولة.

GET/v1/orders/{id}

Retrieve an order

Fetch a finalized order by id, including its status and `final_url` once ready.

النطاق photo.orders.read
الطلب
معلمات المسار
الحقلالنوعالوصف
id*stringOrder id.
مثال على الطلب
curl
curl "https://partner.svoyager.com/v1/orders/8a2d5b40-71c6-4f0e-b3a9-1e7c9d05f284" \
  -H "Authorization: Bearer svoy_sk_live_A8m4Qz1YOURKEYHERExxxxxxx"
الاستجابة · 200
200 · application/json
{
  "object": "photo_order",
  "id": "8a2d5b40-71c6-4f0e-b3a9-1e7c9d05f284",
  "livemode": true,
  "sandbox_emulated": false,
  "status": "final_ready",
  "session_id": "3f9c1e77-2b8a-4a1e-9d2c-6b5a4c3d2e10",
  "spec_id": "spc_9wTv2c1Kd8Qe",
  "final_url": "https://partner.svoyager.com/v1/orders/8a2d5b40-71c6-4f0e-b3a9-1e7c9d05f284/final",
  "watermarked": false,
  "created_at": "2026-07-24T18: 31: 00Z"
}
الأخطاء
الحالةالكودعندما
404order_not_foundNo order matches the id for this account/environment.

بالإضافة إلى أخطاء المصادقة والأذونات وحدود المعدل القياسية — انظر الأخطاء وإعادة المحاولة.

GET/v1/orders/{id}/final

Download the final image

Stream the final image bytes for an order (SVOYAGER-hosted). In live mode this is the no-watermark deliverable; in test mode it is the sandbox-emulated copy. This is the resource `final_url` points to.

النطاق photo.orders.readتُرجع بايتات الصورة
الطلب
معلمات المسار
الحقلالنوعالوصف
id*stringOrder id.
  • Returns raw `image/*` bytes on success (not JSON).
مثال على الطلب
curl
curl "https://partner.svoyager.com/v1/orders/8a2d5b40-71c6-4f0e-b3a9-1e7c9d05f284/final" \
  -H "Authorization: Bearer svoy_sk_live_A8m4Qz1YOURKEYHERExxxxxxx" \
  --output final.jpg
الاستجابة · 200

في حالة النجاح، تقوم نقطة النهاية ببث بايتات الصورة الخام (وليس JSON). احفظ نص الاستجابة في ملف.

الأخطاء
الحالةالكودعندما
404final_not_foundThe order or its final does not exist.

بالإضافة إلى أخطاء المصادقة والأذونات وحدود المعدل القياسية — انظر الأخطاء وإعادة المحاولة.

GET/v1/photo-specifications

List photo specifications

Return a cursor-paginated list of available photo specifications. Filter by country or document type to find the `spec_id` you need.

النطاق photo.specs.read
الطلب
معلمات الاستعلام
الحقلالنوعالوصف
limitintegerPage size, 1–100 (default 20).
starting_afterstringA specification id (`spc_…`) to page after.
countrystringISO-3166 alpha-2 filter, e.g. `US`.
document_typestringFilter by document type, e.g. `passport`.
مثال على الطلب
curl
curl -G "https://partner.svoyager.com/v1/photo-specifications" \
  -H "Authorization: Bearer svoy_sk_test_R2p9Kx7YOURKEYHERExxxxxxx" \
  --data-urlencode "country=US" \
  --data-urlencode "limit=20"
الاستجابة · 200
200 · application/json
{
  "object": "list",
  "data": [
    {
      "object": "photo_specification",
      "id": "spc_9wTv2c1Kd8Qe",
      "name": "United States Passport"
    }
  ],
  "has_more": false,
  "next_cursor": null
}
الأخطاء

تُرجع نقطة النهاية هذه الأخطاء القياسية التالية فقط.

بالإضافة إلى أخطاء المصادقة والأذونات وحدود المعدل القياسية — انظر الأخطاء وإعادة المحاولة.

GET/v1/photo-specifications/{id}

Retrieve a photo specification

Fetch a single specification by its stable `spec_id`, including its full requirements.

النطاق photo.specs.read
الطلب
معلمات المسار
الحقلالنوعالوصف
id*stringSpecification id (`spc_…`).
مثال على الطلب
curl
curl "https://partner.svoyager.com/v1/photo-specifications/spc_9wTv2c1Kd8Qe" \
  -H "Authorization: Bearer svoy_sk_test_R2p9Kx7YOURKEYHERExxxxxxx"
الاستجابة · 200
200 · application/json
{
  "object": "photo_specification",
  "id": "spc_9wTv2c1Kd8Qe",
  "name": "United States Passport",
  "country_code": "US",
  "document_type": "passport",
  "physical_size": {
    "width": 51,
    "height": 51,
    "unit": "mm"
  },
  "pixel_size": {
    "width": 600,
    "height": 600
  },
  "dpi": 300,
  "background": {
    "color": "#FFFFFF",
    "name": "white"
  },
  "requirements": {
    "head_height": "25–35 mm (1–1⅜ in)",
    "eye_to_bottom": "28–35 mm (1⅛–1⅜ in)",
    "recency_months": 6,
    "expression": "neutral",
    "color": true,
    "glasses": "not allowed",
    "eyes_and_ears": "both eyes open"
  },
  "updated_at": "2026-07-01T12: 00: 00Z"
}
الأخطاء
الحالةالكودعندما
404spec_not_foundNo active specification matches the id.

بالإضافة إلى أخطاء المصادقة والأذونات وحدود المعدل القياسية — انظر الأخطاء وإعادة المحاولة.

أرسل رأس Idempotency-Key (قيمة فريدة، مثل UUID) حتى لا يتم فرض رسوم مزدوجة أو معالجة مزدوجة على الطلب الذي تمت إعادة محاولته. وهو مطلوب في:

  • POST /v1/photo-sessions
  • POST /v1/photo-sessions/{id}/finalize
  • نفس المفتاح + نفس النص الأساسي → يتم إعادة عرض النتيجة الأصلية (بدون رسوم إضافية، وبدون عرض ثانٍ).
  • نفس المفتاح + نص مختلف → 409 idempotency_key_reuse.
  • يتيح لك الفشل القابل لإعادة المحاولة إعادة المحاولة باستخدام نفس المفتاح والنص الأساسي وupload_ref.
  • لا يمكن أبدًا لطلبات الإنهاء المتزامنة لجلسة واحدة إنشاء طلبين أو فرض رسوم عليهما.

تمر الجلسة عبر حالات المعاينة؛ بينما يمر الطلب عبر حالات الإنهاء.

حالة الجلسة
  • preview_readyتم إنشاء معاينة، ولا توجد مشكلات.
  • preview_has_issuesمعاينة تم إنشاؤها مع وجود مشكلات.
  • preview_failedتعذر إنشاء المعاينة.
  • finalizedتم إنهاء الجلسة.
حالة الطلب
  • final_readyالنسخة النهائية متاحة.
  • processingيجري إعداد النسخة النهائية.
  • failedفشل إتمام العملية.

يتم تحديد البيئة من خلال بادئة المفتاح الخاصة بك — ولا يمكن للعملاء تجاوزها أبدًا. يعمل وضع الاختبار على عرض معاينة حقيقية تحمل علامة مائية حتى تتمكن من تجربة التدفق الفعلي، ولكنه يحاكي النسخة النهائية بحيث لا يتم استخدام الحصة الحية أو العرض النهائي.

الجانباختبارمباشر
livemodefalsetrue
معاينةحقيقي، مع علامة مائيةحقيقي، مع علامة مائية
نهائيمحاكاة بيئة الاختبار من النسخة التجريبيةحقيقي، بدون علامة مائية
sandbox_emulatedtruefalse
watermarkedtruefalse
الحصة المستهلكةحصة الاختبار فقطالحصة المباشرة فقط

تتضمن خطتك عددًا من «المعاينات» و«النسخ النهائية» لكل فترة، ويتم احتسابها بشكل منفصل. يستهلك إنشاء جلسة واحدة من «المعاينات»؛ بينما يستهلك إنهاء الجلسة واحدة من «النسخ النهائية». يتم حجز الحصة بشكل فوري قبل المعالجة.

  • عند استنفاد الحصة المضمنة في النسخة التجريبية أو النهائية، يُرجع الطلب الرمز 402 quota_exceeded.
  • الرمز 402 يمثل توقفًا تامًا — ولن تنجح إعادة المحاولة حتى الفترة التالية أو تغيير الخطة.
  • الحصص الخاصة بالاختبار والحصص الحية مستقلة تمامًا عن بعضها البعض.

يستخدم كل خطأ مغلفًا واحدًا. يظهر request_id أيضًا في رأس استجابة X-Request-Id — قم بتضمينه في طلبات الدعم.

Error envelope
{
  "error": {
    "type": "invalid_request_error",
    "code": "quota_exceeded",
    "message": "Your included final quota for this period is exhausted.",
    "request_id": "req_9wTv2c1Kd8QeR7"
  }
}

الأخطاء القياسية (جميع نقاط النهاية)

الحالةالكودعندما
401invalid_api_keyMissing, malformed, or unknown API key.
401revoked_api_keyThe key was revoked.
401expired_api_keyThe key passed its rotation grace period.
401wrong_environmentA test key was used on live traffic (or vice versa).
403client_disabledThe API client is disabled.
403api_access_revokedAPI access for the account is not active.
403insufficient_scopeThe key lacks the required scope for this endpoint.
429rate_limitedPer-key rate limit exceeded. Honour `Retry-After`.

يتم إرجاع الرمز 422 فقط في حالة وجود مشكلة مؤكدة في الصورة. الرمز 402 يعني استنفاد الحصة المخصصة. الرمز 409 يشير إلى تعارض في الموارد أو تكرار العمليات.

429 تعني أنك وصلت إلى الحد الأقصى لمعدل الاستخدام لكل مفتاح — التزم برأس Retry-After. بالنسبة لـ 502/503 ورموز 5xx الأخرى، أعد المحاولة مع التراجع (backoff) ونفس Idempotency-Key.

قد تعرض المعاينة صفرًا أو أكثر من المشكلات، كل منها عبارة عن رمز ثابت + رسالة. اعرض هذه المشكلات للمستخدم النهائي حتى يتمكن من إعادة التقاط الصورة. تتحول الإشارة غير المعترف بها من المصدر إلى «other».

الكودالرسالة
face_not_foundNo face was detected in the photo.
uneven_lightingLighting on the face is uneven.
poor_brightnessFace brightness is too dark, too bright, or the photo is low quality.
low_sharpnessThe photo is blurry or not sharp enough.
eyeglasses_not_allowedEyeglasses are not allowed.
sunglasses_not_allowedSunglasses are not allowed.
headwear_not_allowedHats or head coverings are not allowed.
face_mask_not_allowedA face mask is not allowed.
face_covering_foundA face covering was detected.
expression_not_neutralThe expression is not neutral.
crop_bottomNot enough space is visible below the shoulders.
crop_leftNot enough of the left shoulder is visible.
crop_rightNot enough of the right shoulder is visible.
head_turnedThe head is turned too far to the side.
head_tiltedThe head is tilted too far up or down.
not_in_colorThe photo must be in color.
otherThe photo did not meet a requirement.
  • يتم تقديم النسخ المسبقة والنسخ النهائية فقط من عناوين URL المصادق عليها والمستضافة على SVOYAGER. يتطلب الوصول مفتاح API الخاص بك والنطاق الصحيح — ولا يتم الكشف عن التخزين الأساسي للجمهور أبدًا.
  • الصور التي تم تحميلها خاصة ومقتصرة على حسابك وبيئتك؛ وأهداف التحميل قصيرة الأمد وذات استخدام واحد.
  • تتم معالجة صور المستندات لإنتاج النتيجة الخاصة بك ولا يتم مشاركتها عبر الحسابات.

انظر شروط معالجة البيانات والاحتفاظ بها وحذفها الخاصة بـ SVOYAGER:سياسة الخصوصية ·اتفاقية الشراكة والشروط