SVOYAGER ID Photo API
Chuyển đổi bất kỳ ảnh nào thành ảnh thẻ căn cước / hộ chiếu / thị thực hợp lệ.
Tổng quan
Chức năng
SVOYAGER ID Photo API biến một bức ảnh chân dung thông thường thành ảnh thẻ tuân thủ quy định. ID Photo là một sản phẩm duy nhất: hộ chiếu, thị thực, giấy phép cư trú và thẻ căn cước quốc gia được thể hiện dưới dạng các thông số kỹ thuật của tài liệu, không phải là các sản phẩm riêng biệt. Bạn tải lên một bức ảnh, tạo bản xem trước có dấu nước dựa trên một thông số kỹ thuật, sau đó hoàn tất để nhận kết quả không có dấu nước.
Xem trước → quy trình làm việc cuối cùng
- 1Tải lên ảnh. Tạo một đích tải lên và gửi các byte hình ảnh đến đó.
- 2Tạo phiên. Hiển thị bản xem trước có dấu nước dựa trên thông số kỹ thuật. Kiểm tra các vấn đề được trả về.
- 3Hoàn tất. Chuyển phiên bản đã được xem xét thành đơn đặt hàng và nhận bản cuối cùng không có hình mờ.
Hướng dẫn nhanh
Mỗi yêu cầu đều được xác thực bằng khóa bí mật Bearer. Bắt đầu ở chế độ thử nghiệm:
# 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 cơ sở & môi trường
Tất cả các điểm cuối đều được phục vụ dưới một URL cơ sở duy nhất:
https://partner.svoyager.com/v1Không có đường dẫn hoặc tham số môi trường. Việc yêu cầu được thực thi trong môi trường thử nghiệm hay sản xuất hoàn toàn phụ thuộc vào tiền tố khóa API của bạn (svoy_sk_test_… so với svoy_sk_live_…). Các phản hồi sẽ phản ánh điều này dưới dạng livemode.
Xác thực
Khóa API
Xác thực mọi yêu cầu bằng tiêu đề Authorization chứa khóa bí mật của bạn. Các khóa được tạo và luân chuyển trong Trung tâm Đối tác.
Authorization: Bearer svoy_sk_test_R2p9Kx7YOURKEYHERExxxxxxxTiền tố xác định môi trường: svoy_sk_test_… dành cho môi trường thử nghiệm, svoy_sk_live_… dành cho môi trường sản xuất. Khóa thử nghiệm không bao giờ được phép truy cập dữ liệu sản xuất (và ngược lại) — các trường hợp không khớp sẽ trả về mã trạng thái 401 (wrong_environment).
Phạm vi
Các khóa mang phạm vi quyền hạn tối thiểu rõ ràng. Yêu cầu thiếu phạm vi quyền hạn bắt buộc sẽ trả về mã trạng thái 403 insufficient_scope.
| Phạm vi | Quyền truy cập |
|---|---|
| photo.specs.read | List and retrieve photo specifications. |
| photo.sessions.read | Retrieve sessions and their previews. |
| photo.sessions.write | Create uploads and photo sessions (previews). |
| photo.finalize.write | Finalize a session into a no-watermark order. |
| photo.orders.read | Retrieve orders and download finals. |
Bảo mật các khóa
Khóa bí mật chỉ được sử dụng giữa các máy chủ với nhau. Không bao giờ nhúng khóa bí mật vào mã trình duyệt hoặc mã di động, kho lưu trữ công khai hoặc gói phần mềm phía máy khách. Nếu khóa bị lộ, hãy thay đổi khóa ngay lập tức trong Trung tâm Đối tác.
Các điểm cuối
Các trường bắt buộc được đánh dấu bằng *. Các ví dụ sử dụng thông tin đăng nhập giả — không bao giờ sử dụng khóa thực.
/v1/uploadsUpload 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| Trường | Loại | Mô tả |
|---|---|---|
| content_type* | string | MIME type of the image.image/jpegimage/pngimage/webpimage/heic |
- `upload_url` is single-use and expires; upload promptly and do not modify the URL.
# 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{
"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"
}| Trạng thái | Mã | Khi |
|---|---|---|
| 400 | missing_content_type | `content_type` was not provided. |
| 415 | unsupported_format | The content type is not an accepted image format. |
| 503 | temporarily_unavailable | Uploads are temporarily unavailable. |
| 502 | upload_init_failed | The upload could not be initialised — retry shortly. |
Ngoài ra còn có các lỗi xác thực, quyền truy cập và giới hạn tốc độ tiêu chuẩn — xem Lỗi và thử lại.
/v1/photo-sessionsCreate 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 là bắt buộc| Trường | Loại | Mô tả |
|---|---|---|
| upload_ref* | string | The `upload_ref` from Upload a photo. |
| spec_id* | string | The `photo_specification` id (`spc_…`) to render against. |
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"}'{
"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"
}| Trạng thái | Mã | Khi |
|---|---|---|
| 400 | missing_idempotency_key | The `Idempotency-Key` header is missing. |
| 400 | missing_upload_ref | `upload_ref` is missing. |
| 400 | missing_spec_id | `spec_id` is missing. |
| 400 | invalid_upload_ref | The referenced upload could not be read. |
| 413 | file_too_large | The uploaded file exceeds 10 MB. |
| 415 | unsupported_format | The uploaded file is not an accepted image format. |
| 404 | spec_not_found | No active specification matches `spec_id`. |
| 402 | no_active_plan | No active plan is assigned for this environment. |
| 402 | quota_exceeded | Included preview quota for the period is exhausted. |
| 402 | plan_inactive | The plan is not active for this environment. |
| 409 | idempotency_key_reuse | The key was reused with a different body. |
| 409 | request_in_progress | A request with this key is still processing. |
| 422 | unprocessable_image | The image could not be processed. |
| 502 | provider_error | The preview could not be generated upstream — retry shortly. |
| 503 | provider_busy | The processing service is busy — retry shortly. |
Ngoài ra còn có các lỗi xác thực, quyền truy cập và giới hạn tốc độ tiêu chuẩn — xem Lỗi và thử lại.
/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| Trường | Loại | Mô tả |
|---|---|---|
| id* | string | Session id. |
curl "https://partner.svoyager.com/v1/photo-sessions/3f9c1e77-2b8a-4a1e-9d2c-6b5a4c3d2e10" \
-H "Authorization: Bearer svoy_sk_test_R2p9Kx7YOURKEYHERExxxxxxx"{
"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"
}| Trạng thái | Mã | Khi |
|---|---|---|
| 404 | session_not_found | No session matches the id for this account/environment. |
Ngoài ra còn có các lỗi xác thực, quyền truy cập và giới hạn tốc độ tiêu chuẩn — xem Lỗi và thử lại.
/v1/photo-sessions/{id}/previewDownload 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.readTrả về các byte hình ảnh| Trường | Loại | Mô tả |
|---|---|---|
| id* | string | Session id. |
- Returns raw `image/*` bytes on success (not JSON).
curl "https://partner.svoyager.com/v1/photo-sessions/3f9c1e77-2b8a-4a1e-9d2c-6b5a4c3d2e10/preview" \
-H "Authorization: Bearer svoy_sk_test_R2p9Kx7YOURKEYHERExxxxxxx" \
--output preview.jpgKhi thành công, điểm cuối sẽ truyền các byte hình ảnh thô (không phải JSON). Lưu nội dung phản hồi vào một tệp.
| Trạng thái | Mã | Khi |
|---|---|---|
| 404 | preview_not_found | The session or its preview does not exist. |
Ngoài ra còn có các lỗi xác thực, quyền truy cập và giới hạn tốc độ tiêu chuẩn — xem Lỗi và thử lại.
/v1/photo-sessions/{id}/finalizeFinalize 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 là bắt buộc| Trường | Loại | Mô tả |
|---|---|---|
| id* | string | Session id to finalize. |
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"{
"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"
}| Trạng thái | Mã | Khi |
|---|---|---|
| 400 | missing_idempotency_key | The `Idempotency-Key` header is missing. |
| 404 | session_not_found | No session matches the id for this account/environment. |
| 422 | session_not_finalizable | The session is not in a finalizable state. |
| 402 | no_active_plan | No active plan is assigned for this environment. |
| 402 | quota_exceeded | Included final quota for the period is exhausted. |
| 402 | plan_inactive | The plan is not active for this environment. |
| 409 | idempotency_key_reuse | The key was reused with a different request. |
| 409 | request_in_progress | A request with this key is still processing. |
| 502 | provider_error | The final could not be produced upstream — retry shortly. |
| 503 | provider_busy | The processing service is busy — retry shortly. |
Ngoài ra còn có các lỗi xác thực, quyền truy cập và giới hạn tốc độ tiêu chuẩn — xem Lỗi và thử lại.
/v1/orders/{id}Retrieve an order
Fetch a finalized order by id, including its status and `final_url` once ready.
photo.orders.read| Trường | Loại | Mô tả |
|---|---|---|
| id* | string | Order id. |
curl "https://partner.svoyager.com/v1/orders/8a2d5b40-71c6-4f0e-b3a9-1e7c9d05f284" \
-H "Authorization: Bearer svoy_sk_live_A8m4Qz1YOURKEYHERExxxxxxx"{
"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"
}| Trạng thái | Mã | Khi |
|---|---|---|
| 404 | order_not_found | No order matches the id for this account/environment. |
Ngoài ra còn có các lỗi xác thực, quyền truy cập và giới hạn tốc độ tiêu chuẩn — xem Lỗi và thử lại.
/v1/orders/{id}/finalDownload 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.readTrả về các byte hình ảnh| Trường | Loại | Mô tả |
|---|---|---|
| id* | string | Order id. |
- Returns raw `image/*` bytes on success (not JSON).
curl "https://partner.svoyager.com/v1/orders/8a2d5b40-71c6-4f0e-b3a9-1e7c9d05f284/final" \
-H "Authorization: Bearer svoy_sk_live_A8m4Qz1YOURKEYHERExxxxxxx" \
--output final.jpgKhi thành công, điểm cuối sẽ truyền các byte hình ảnh thô (không phải JSON). Lưu nội dung phản hồi vào một tệp.
| Trạng thái | Mã | Khi |
|---|---|---|
| 404 | final_not_found | The order or its final does not exist. |
Ngoài ra còn có các lỗi xác thực, quyền truy cập và giới hạn tốc độ tiêu chuẩn — xem Lỗi và thử lại.
/v1/photo-specificationsList 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| Trường | Loại | Mô tả |
|---|---|---|
| limit | integer | Page size, 1–100 (default 20). |
| starting_after | string | A specification id (`spc_…`) to page after. |
| country | string | ISO-3166 alpha-2 filter, e.g. `US`. |
| document_type | string | Filter by document type, e.g. `passport`. |
curl -G "https://partner.svoyager.com/v1/photo-specifications" \
-H "Authorization: Bearer svoy_sk_test_R2p9Kx7YOURKEYHERExxxxxxx" \
--data-urlencode "country=US" \
--data-urlencode "limit=20"{
"object": "list",
"data": [
{
"object": "photo_specification",
"id": "spc_9wTv2c1Kd8Qe",
"name": "United States Passport"
}
],
"has_more": false,
"next_cursor": null
}Điểm cuối này chỉ trả về các lỗi tiêu chuẩn dưới đây.
Ngoài ra còn có các lỗi xác thực, quyền truy cập và giới hạn tốc độ tiêu chuẩn — xem Lỗi và thử lại.
/v1/photo-specifications/{id}Retrieve a photo specification
Fetch a single specification by its stable `spec_id`, including its full requirements.
photo.specs.read| Trường | Loại | Mô tả |
|---|---|---|
| id* | string | Specification id (`spc_…`). |
curl "https://partner.svoyager.com/v1/photo-specifications/spc_9wTv2c1Kd8Qe" \
-H "Authorization: Bearer svoy_sk_test_R2p9Kx7YOURKEYHERExxxxxxx"{
"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"
}| Trạng thái | Mã | Khi |
|---|---|---|
| 404 | spec_not_found | No active specification matches the id. |
Ngoài ra còn có các lỗi xác thực, quyền truy cập và giới hạn tốc độ tiêu chuẩn — xem Lỗi và thử lại.
Gửi tiêu đề Idempotency-Key (một giá trị duy nhất, ví dụ: UUID) để yêu cầu được thử lại không bao giờ bị tính phí hoặc xử lý trùng lặp. Điều này bắt buộc đối với:
POST /v1/photo-sessionsPOST /v1/photo-sessions/{id}/finalize
- • Cùng khóa + cùng nội dung → kết quả ban đầu sẽ được phát lại (không tính phí lần thứ hai, không hiển thị lại).
- • Cùng một khóa + nội dung khác → 409 idempotency_key_reuse.
- • Lỗi có thể thử lại cho phép bạn thử lại với cùng một khóa, nội dung và upload_ref.
- • Các yêu cầu hoàn tất đồng thời cho một phiên không bao giờ được tạo ra hoặc tính phí cho hai đơn hàng.
Một phiên trải qua các trạng thái xem trước; một đơn hàng trải qua các trạng thái hoàn tất.
preview_ready— Bản xem trước đã được tạo, không có vấn đề gì.preview_has_issues— bản xem trước được tạo ra với các vấn đề.preview_failed— không thể tạo bản xem trước.finalized— phiên làm việc đã kết thúc.
final_ready— phiên bản cuối cùng đã có sẵn.processing— phiên bản cuối cùng đang được chuẩn bị.failed— quá trình hoàn tất đã thất bại.
Môi trường được xác định bởi tiền tố khóa của bạn — khách hàng không bao giờ được truyền thông tin này. Chế độ thử nghiệm chạy bản xem trước thực tế có dấu nước để bạn thực hành quy trình thực tế, nhưng mô phỏng kết quả cuối cùng nên không sử dụng hạn ngạch trực tiếp hoặc kết xuất sản xuất.
| Aspect | Kiểm tra | Trực tiếp |
|---|---|---|
| livemode | false | true |
| Xem trước | Thực, có hình mờ | Thực, có hình mờ |
| Cuối cùng | Môi trường thử nghiệm được mô phỏng từ bản xem trước | Thật, không có hình mờ |
| sandbox_emulated | true | false |
| watermarked | true | false |
| Hạn mức đã sử dụng | Chỉ kiểm tra hạn mức | Chỉ áp dụng cho hạn ngạch trực tiếp |
Gói dịch vụ của bạn bao gồm một số lượt xem trước và lượt hoàn thiện cho mỗi kỳ, được tính riêng biệt. Việc tạo phiên dịch sẽ tiêu tốn một lượt xem trước; việc hoàn thiện sẽ tiêu tốn một lượt hoàn thiện. Hạn mức được dành riêng một cách nguyên vẹn trước khi xử lý.
- Khi hạn mức xem trước hoặc hạn mức cuối cùng đi kèm đã cạn kiệt, yêu cầu sẽ trả về mã trạng thái 402 quota_exceeded.
- 402 là lỗi không thể khắc phục — việc thử lại sẽ không thành công cho đến kỳ tiếp theo hoặc khi có sự thay đổi về gói dịch vụ.
- Hạn mức thử nghiệm và hạn mức sản xuất hoàn toàn độc lập với nhau.
Mỗi lỗi sử dụng một envelope. Request_id cũng xuất hiện trong tiêu đề phản hồi X-Request-Id — hãy bao gồm nó trong các yêu cầu hỗ trợ.
{
"error": {
"type": "invalid_request_error",
"code": "quota_exceeded",
"message": "Your included final quota for this period is exhausted.",
"request_id": "req_9wTv2c1Kd8QeR7"
}
}Lỗi tiêu chuẩn (tất cả các điểm cuối)
| Trạng thái | Mã | Khi |
|---|---|---|
| 401 | invalid_api_key | Missing, malformed, or unknown API key. |
| 401 | revoked_api_key | The key was revoked. |
| 401 | expired_api_key | The key passed its rotation grace period. |
| 401 | wrong_environment | A test key was used on live traffic (or vice versa). |
| 403 | client_disabled | The API client is disabled. |
| 403 | api_access_revoked | API access for the account is not active. |
| 403 | insufficient_scope | The key lacks the required scope for this endpoint. |
| 429 | rate_limited | Per-key rate limit exceeded. Honour `Retry-After`. |
Mã trạng thái 422 chỉ được trả về khi có vấn đề về hình ảnh đã được xác nhận. Mã trạng thái 402 có nghĩa là hạn mức đã cạn kiệt. Mã trạng thái 409 là xung đột về tính idempotent hoặc tài nguyên.
429 có nghĩa là bạn đã đạt đến giới hạn tốc độ cho mỗi khóa — hãy tuân thủ tiêu đề Retry-After. Đối với 502/503 và các mã 5xx khác, hãy thử lại với thời gian chờ và cùng một Idempotency-Key.
Kết quả xem trước có thể trả về không hoặc nhiều vấn đề, mỗi vấn đề là một mã ổn định kèm theo thông báo. Hiển thị các thông tin này cho người dùng cuối để họ có thể chụp lại ảnh. Một tín hiệu nguồn không được nhận diện sẽ được chuyển sang trạng thái "other".
| Mã | Thông điệp |
|---|---|
| face_not_found | No face was detected in the photo. |
| uneven_lighting | Lighting on the face is uneven. |
| poor_brightness | Face brightness is too dark, too bright, or the photo is low quality. |
| low_sharpness | The photo is blurry or not sharp enough. |
| eyeglasses_not_allowed | Eyeglasses are not allowed. |
| sunglasses_not_allowed | Sunglasses are not allowed. |
| headwear_not_allowed | Hats or head coverings are not allowed. |
| face_mask_not_allowed | A face mask is not allowed. |
| face_covering_found | A face covering was detected. |
| expression_not_neutral | The expression is not neutral. |
| crop_bottom | Not enough space is visible below the shoulders. |
| crop_left | Not enough of the left shoulder is visible. |
| crop_right | Not enough of the right shoulder is visible. |
| head_turned | The head is turned too far to the side. |
| head_tilted | The head is tilted too far up or down. |
| not_in_color | The photo must be in color. |
| other | The photo did not meet a requirement. |
- • Các bản xem trước và bản chính thức chỉ được cung cấp từ các URL được xác thực và lưu trữ trên SVOYAGER. Để truy cập, bạn cần có khóa API và phạm vi quyền truy cập chính xác — kho lưu trữ cơ bản không bao giờ được công khai.
- • Các hình ảnh đã tải lên là riêng tư và chỉ áp dụng cho tài khoản và môi trường của bạn; các mục tiêu tải lên có thời hạn ngắn và chỉ sử dụng một lần.
- • Hình ảnh tài liệu được xử lý để tạo ra kết quả của bạn và không được chia sẻ giữa các tài khoản.
Xem các điều khoản về xử lý, lưu trữ và xóa dữ liệu của SVOYAGER:Chính sách bảo mật ·Thỏa thuận và Điều khoản Đối tác