API Reference
Everything you need to integrate the Rupam.ai skin analysis engine into your product, from your own server.
https://api.rupam.ai/v2HTTPS onlyJSON · problem+json errorsStart here
A secret key (rsk_) is for your server only. Never put it in a browser page or a mobile app.
On this page
How a scan runs
Every scan is a session. The integration your key belongs to has a live workflow, and the workflow decides the steps the session goes through. A new API integration starts on your organisation's ready-made Scan workflow; you can choose another published workflow on the integration's page in the dashboard, for example one that adds a quiz or product recommendations.
On an API integration there is no Rupam page in the flow: your server asks the person each question, takes the photo and shows the result, and tells Rupam each answer. With the Scan workflow the steps are:
- 1Start a session with
POST /v2/sessions. Storesession.id. - 2Age check. The session's first step is
__age_gate: send the person's age bracket. A person under 18, or one whose age is unknown, ends the session (outcomeage_ineligible). - 3Notice and consent. Read the session:
current_renderholds the notice text. Show it, then send the person's decision to__notice_consent. - 4Photo. Ask for an upload grant, upload the photo to it, and answer the photo step with the
upload_id. The photo is checked and scanned. - 5Result. When the session reaches its result step, read
GET …/result, show it, and confirm it was shown. The session ends with outcomeresult_delivered.
You never hard-code the order: after each answer, read the session and answer whatever current_step is, by its current_step_type, when step_run_status is awaiting_input. A new created session names its first step the same way. Anything else means Rupam is working: wait poll_after_ms and read again. That way your code keeps working when the workflow changes.
What is billed
| Call | Billed? |
|---|---|
POST /v2/sessions | No. Starting a session is free; the daily and per-minute limits still count it |
The photo step | One scan per session, billed when the skin scan succeeds. A refused or rejected photo is not billed, and neither is a session cancelled or ended before its scan succeeded |
Confirming the result shown | Only in a workflow without a skin scan (a quiz alone): the session's one unit is billed when its result is first confirmed shown |
Every other call | No |
Plans and API access
Prices are on the Pricing page. This is what each plan gives an API customer.
| Free | Starter | Growth | Professional | |
|---|---|---|---|---|
| Getting API access | On request | On request | Included | Included |
| Scans per plan period | 150 | 2,500 | 10,000 | 50,000 |
| Sessions started per minute, per integration | 10 | 50 | 150 | 500 |
| Sessions per day | 100 | 500 | 2,000 | 8,000 |
| Extra scans, per scan | Not available | $0.05 (India: ₹3 + GST) | $0.035 (India: ₹2.25 + GST) | $0.025 (India: ₹1.5 + GST) |
| Skin conditions returned | 4 | 8 | 12 | 15 |
| Result images kept | 15 minutes | 15 minutes | 7 days | 30 days |
| Product recommendations | No | Yes, up to 50 products | Yes, up to 500 products | Yes, up to 2,000 products |
Free and Starter: request access
In the dashboard, open Integrations and choose Request API Key Access, with your website and what you will use the API for. Our team reviews each request. While it is open the page shows Request pending; if it is declined you can choose Request again. Once it is approved you can create keys.
When access is removed
If the plan no longer includes API access, starting a session answers 403 module_not_in_plan. An account suspended after a failed payment answers 403 org_suspended until it is settled.
Keys and authentication
There is no token exchange. Send your secret key itself, as a Bearer token, on every call:
Authorization: Bearer rsk_...Create a secret key
- 1Log in to the Rupam dashboard and open Integrations.
- 2Add an API integration to a project. It starts on your organisation's ready-made Scan workflow.
- 3On the integration's page, under API keys, choose Create key. Give it a label (for example “Production server”) and, if you want, an expiry date.
- 4Copy the key from the dialog. It starts
rsk_and is shown once only.
401 invalid_credential.The Idempotency-Key header
Every POST that creates something (a session, a step answer, an upload grant, a consent record) needs an Idempotency-Key header of up to 255 characters. Without it the answer is 400 idempotency_key_required.
- Use a new value (a UUID) for each new request.
- After a network error or a timeout, retry with the same value. You get the first answer again, with
Idempotent-Replayed: true, and nothing happens twice. - The same value with a different body is
422 idempotency_key_reused. - An upload grant holds a secret, so it is never replayed: a retry is
409 idempotency_secret_not_replayable. Ask for a new grant with a new value. …/canceland…/redeemtake no Idempotency-Key.
Publishable keys (rpk_)
Some integrations also offer a publishable key, for browser pages. It can only start a session (POST /v2/sessions) and read GET /v2/sessions/bootstrap, and only from the sites listed in the integration's allowed origins; anywhere else it answers 403 origin_not_allowed. Everything else on this page needs the secret key.
Every call a key can make
These are all the routes that answer a key. Every other /v2 route is for the dashboard and answers a key with 401 token_audience or 403 scope_missing.
| Call | Key | What it does |
|---|---|---|
| POST /v2/sessions | rsk_, rpk_ | Start a session on the key's integration |
| GET /v2/sessions/{ses_id} | rsk_ | Read the session's status and current step |
| POST /v2/sessions/{ses_id}/steps | rsk_ (API integrations) | Answer the current step |
| POST /v2/sessions/{ses_id}/upload-grants | rsk_ (API integrations) | Get a one-time upload for the photo |
| GET /v2/sessions/{ses_id}/result | rsk_ | Read the result |
| POST /v2/sessions/{ses_id}/redeem | rsk_ | Swap a one-time result handle for the result |
| POST /v2/sessions/{ses_id}/cancel | rsk_ | Cancel an open session |
| POST /v2/sessions/{ses_id}/consent-records | rsk_ | Record that the person withdrew consent |
| GET /v2/sessions/bootstrap | rpk_, rsk_ | The published workflow's languages and steps, before a session exists |
| GET /v2/usage | rsk_ | Usage by day and the current plan period |
| GET /v2/plans | rsk_ | The plans on sale, with their prices and limits |
Start a session — POST /v2/sessions
/v2/sessionsOn an API integration the body can be empty ({}): the key names the integration, and the integration's live workflow decides the steps. Unknown fields are refused with 422 validation_failed. Optional fields include locale (the person's language) and correlation_ref (a reference of your own; never put personal data in it).
curl -sS -X POST "https://api.rupam.ai/v2/sessions" \
-H "Authorization: Bearer $RUPAM_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{}'Response
HTTP/1.1 201 Created
{
"session": {
"id": "ses_...",
"status": "created",
"expires_at": "2026-11-23T11:15:00Z",
"locale": "en",
"offered_languages": ["en"],
"integration_id": "int_...",
"project_id": "prj_..."
},
"client_token": null,
"capture_url": null
}A new session reads status: "created" until its first answer. It expires at expires_at; after that, start a new one. client_token and capture_url are nullon an API integration: they belong to flows where the person uses Rupam's own page.
Read the session — GET /v2/sessions/{ses_id}
/v2/sessions/{ses_id}curl -sS "https://api.rupam.ai/v2/sessions/$SES_ID" \
-H "Authorization: Bearer $RUPAM_KEY"Response
{
"id": "ses_...",
"status": "active",
"outcome": null,
"seq": 4,
"current_step": "__notice_consent",
"current_step_type": "rupam.notice_consent@1.0",
"current_render": {
"notice": "...",
"language": "en",
"text": "...the notice to show the person...",
"purposes": ["analysis"]
},
"step_run_status": "awaiting_input",
"retake": null,
"progress": null,
"locale": "en",
"offered_languages": ["en"],
"expires_at": "2026-11-23T11:15:00Z",
"poll_after_ms": null
}| Field | Meaning |
|---|---|
status | created or active while the session is open; completed, cancelled, expired, abandoned or failed once it ended |
outcome | On a completed session: result_delivered, ended_without_result, consent_declined, age_ineligible, minor_mode_completed, not_available, limit_reached or signed_up. Else null |
current_step | The key of the step to answer now, or null |
current_step_type | What kind of step it is, such as rupam.age_gate@1.0, rupam.notice_consent@1.0, rupam.capture_selfie@1.0, rupam.quiz@1.0 or rupam.result@1.0. Match on the part before @ |
current_render | While the step waits for the person: what to show (the notice text and purposes, the quiz questions, the photo options). Else null |
step_run_status | running while Rupam works on the step (photo check, scan, product picks): wait and read again. awaiting_input when it waits for you |
retake | Why the photo step is asking again: no_face, multiple_faces, face_too_small, blurry, too_dark, too_bright, image_unreadable, image_too_large, upload_missing, upload_not_image or upload_too_large. Else null |
progress | While the photo or scan runs: stage is queued, checking_photo or analysing |
poll_after_ms | How long to wait before the next read |
The answer carries an ETag: send it back as If-None-Match and an unchanged session answers 304 with no body.
Answer a step — POST /v2/sessions/{ses_id}/steps
/v2/sessions/{ses_id}/stepsThe body is {"step_key": <current_step>, "input": {…}}. The first answer starts a created session. An input that does not fit the step is 422 validation_failed and the step stays open.
| Step type | input | Notes |
|---|---|---|
rupam.age_gate | {"bracket": "25-34"} | One of under_18, 18-24, 25-34, 35-44, 45-54, 55+, unknown. Ask the person; never guess. With the Scan workflow, under_18 and unknown end the session (outcome age_ineligible); a workflow can instead continue in a mode for minors. |
rupam.notice_consent | {"decision": "granted"} | granted or declined, for every purpose in the notice. Show current_render.text first. A decline ends the session with outcome consent_declined. |
rupam.capture_selfie | {"upload_id": "upl_…"} | The upload from an upload grant. The photo is checked and scanned, which takes a while: read the session again after poll_after_ms. |
rupam.quiz | {"answers": {…}} | Only in workflows with a quiz. The question and option IDs from current_render: see Quizzes. |
rupam.result | {"shown": true} | Send it after you showed the result. The session ends with outcome result_delivered. |
The skin scan itself (rupam.skin_scan) and product picks (rupam.recommendations) are system steps: they take no input, and the session moves on by itself while step_run_status is running.
# The age check (always first while current_step is "__age_gate")
curl -sS -X POST "https://api.rupam.ai/v2/sessions/$SES_ID/steps" \
-H "Authorization: Bearer $RUPAM_KEY" -H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"step_key": "__age_gate", "input": {"bracket": "25-34"}}'
# The notice: send the decision the person made
curl -sS -X POST "https://api.rupam.ai/v2/sessions/$SES_ID/steps" \
-H "Authorization: Bearer $RUPAM_KEY" -H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"step_key": "__notice_consent", "input": {"decision": "granted"}}'Response
{
"session_id": "ses_...",
"status": "active",
"outcome": null,
"current_step": "capture",
"step_run_id": "...",
"awaiting": true,
"in_line": null,
"code": null,
"client": null
}in_line (position, estimate_s, retry_after_s) appears while the scan waits in the queue. A step type you don't know belongs to a workflow this page does not cover: show what current_render holds, or move the integration to the Scan workflow.
Upload the photo — POST /v2/sessions/{ses_id}/upload-grants
/v2/sessions/{ses_id}/upload-grantsWhen current_step is the photo step, ask for a grant with the photo's content_type: image/jpeg, image/png or image/webp. The answer (201) is a one-time upload: upload_id, method, url, fields and expires_at.
- When
methodisPOST, send a multipart form tourlwith every entry offieldsas a form field, then the photo last, as the fieldfile. - When
methodisPUT, send the photo as the body and every entry offieldsas a header. - Do not send your
Authorizationheader to the upload URL. - Photos up to 10 MB. A grant is a secret: don't log it.
curl -sS -X POST "https://api.rupam.ai/v2/sessions/$SES_ID/upload-grants" \
-H "Authorization: Bearer $RUPAM_KEY" -H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"content_type": "image/jpeg"}'
# 201: {"upload_id": "upl_...", "method": "POST", "url": "https://...", "fields": {...}, "expires_at": "..."}
# Then send the photo to that url: every entry of fields as a form field, the photo last as "file".
# No Authorization header on this upload.
curl -sS -X POST "$UPLOAD_URL" --form-string "key=..." --form-string "..." -F "file=@face.jpg"
# Then answer the photo step with the upload_id
curl -sS -X POST "https://api.rupam.ai/v2/sessions/$SES_ID/steps" \
-H "Authorization: Bearer $RUPAM_KEY" -H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d "{\"step_key\": \"$STEP\", \"input\": {\"upload_id\": \"$UPLOAD_ID\"}}"retake says why (for example no_face or blurry). Ask the person for a new photo and take a new grant. A refused photo is not billed.Photo tips for the person
Only one person in the frame, face filling a good part of the photo, front-facing, even diffuse light, no sunglasses or mask, camera about arm's length away.
Quizzes
A workflow can ask the person a short quiz (for example about how their skin feels) as one of its steps. You build the quiz and add it to a workflow in the dashboard. When the session reaches it, current_step_type is rupam.quiz@… and current_renderholds the questions in the session's language:
"current_step": "skin_quiz",
"current_step_type": "rupam.quiz@1.0",
"step_run_status": "awaiting_input",
"current_render": {
"questions": [
{
"id": "q_skin_feel",
"kind": "single",
"required": true,
"text": "How does your skin feel by midday?",
"options": [
{ "id": "o_oily", "text": "Shiny all over" },
{ "id": "o_combo", "text": "Shiny on the forehead and nose only" },
{ "id": "o_dry", "text": "Tight or flaky" }
]
},
{
"id": "q_concerns",
"kind": "multi",
"required": false,
"text": "What would you like to work on?",
"options": [
{ "id": "o_spots", "text": "Spots" },
{ "id": "o_tone", "text": "Uneven tone" }
]
}
]
}- Show each question's
textand its options. Atextcan benullwhen the quiz has none in that language. - Answer with
{"answers": {<question id>: …}}: one option ID for asinglequestion, a list of option IDs for amultiquestion. - Option IDs only, never free text. Every question with
required: truemust be answered. A wrong answer is422 validation_failedand the quiz stays open. - When the workflow also has product recommendations, the answers can shape the picks.
curl -sS -X POST "https://api.rupam.ai/v2/sessions/$SES_ID/steps" \
-H "Authorization: Bearer $RUPAM_KEY" -H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"step_key": "skin_quiz", "input": {"answers": {
"q_skin_feel": "o_combo",
"q_concerns": ["o_spots", "o_tone"]
}}}'Read the result — GET /v2/sessions/{ses_id}/result
/v2/sessions/{ses_id}/resultThe result exists once the session reaches its result step. Until then the answer is 409 result_not_ready: read the session and try again. It stays readable after the session ended.
curl -sS "https://api.rupam.ai/v2/sessions/$SES_ID/result" \
-H "Authorization: Bearer $RUPAM_KEY"Response
{
"session_id": "ses_...",
"status": "active",
"outcome": null,
"result_step": "result",
"delivered": false,
"steps": [
// one entry per completed step: step_key, step_type, outcome, output
],
"skin_result": {
"scan_id": "...",
"scanned_at": "2026-11-23T10:15:02Z",
"overall": { "score": 72, "grade": "B", "served_severity": "...", "display_text": "..." },
"skin_profile": {
"skin_tone": { "category": "...", "ita_angle": 28.4, "fitzpatrick_estimate": 4, "skin_tone_label": "..." },
"skin_type": { "classification": "combination", "confidence": 0.81, "score": 3 }
},
"conditions": [
{
"key": "acne",
"name": "Acne",
"score": 91,
"grade": "A",
"served_severity": "...",
"tier": "...",
"display_text": "...",
"confidence": 0.84,
"overlays": [{ "object_id": "obj_...", "kind": "acne_overlay" }],
"age_estimate": null,
"age_range": null,
"dominant_depth": null,
"distribution": null
}
// ...one entry per condition in your plan
],
"face_overlays": [{ "object_id": "obj_...", "kind": "..." }],
"advice": [
{ "suggestions_key": "...", "condition_key": "acne", "category": "...", "priority": "...", "text": "...", "routine_slot": "..." }
],
"stamp": { "model_set_id": "...", "model_set_label": "...", "threshold_set_id": "...", "threshold_set_label": "..." }
},
"product_block": null,
"client": null
}| Field | Meaning |
|---|---|
skin_result.overall | The overall score (0–100), its grade and severity, and display_text to show |
skin_result.conditions[] | One entry per condition in your plan (see the Conditions reference): key, name, score (0–100, higher is clearer skin), grade, served_severity, tier, confidence and the overlays drawn for it. For skin_age, show age_estimate and age_range instead of the score |
skin_result.skin_profile | skin_tone (category, ita_angle, fitzpatrick_estimate, skin_tone_label) and skin_type (classification, confidence, score). The skin tone is an estimate from the photo's colours, not a clinical grading |
skin_result.advice[] | Care suggestions per condition, with category, priority, text and routine_slot |
skin_result.stamp | Which model set and threshold set produced the result. Quote it when you contact us |
product_block | Your own products, ranked for this result, when the workflow has a recommendations step. See Product recommendations |
steps[] | Each completed step: step_key, step_type, outcome and its output (IDs and scores only) |
delivered | true once you confirmed the result was shown |
overlays and face_overlays name each image by object_id and kind. The image files themselves are not served to API keys yet.{"shown": true}:curl -sS -X POST "https://api.rupam.ai/v2/sessions/$SES_ID/steps" \
-H "Authorization: Bearer $RUPAM_KEY" -H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"step_key": "result", "input": {"shown": true}}'
# The session ends: status "completed", outcome "result_delivered". The result stays readable.Content-Language). New fields can appear at any time: ignore what you don't know.Product recommendations
Rupam can rank your own products for each result. Set it up in the dashboard: add your products to a catalogue, publish a recommendations setup, and use a workflow with a recommendations step (rupam.recommendations) after the scan. The step is a system step: it needs no input, and it never makes the scan fail. Which plans include it is in the plans table.
The products arrive in the result's product_block:
| product_block | Meaning |
|---|---|
null | The workflow has no recommendations step |
{ rec_id, products[], by_concern[], disclaimer, disclosure, consult_notes, routine } | The ranked picks. products lists each product with the reason it was picked; by_concern groups them by the conditions found. routine is a morning and evening routine on Growth and Professional, else null |
{ status: "empty", reason } | Nothing to show: config_missing, disabled, channel_off, no_catalogue or nothing_qualifies |
{ status: "degraded", reason } | The picks could not be made this time: config_invalid or failed. The skin result is unaffected |
disclaimer and disclosure.ranking_explainer wherever you show the products. The picks are cosmetic suggestions, not treatment advice.More session calls
Cancel a session
/v2/sessions/{ses_id}/cancelNo body and no Idempotency-Key. An open session ends cancelled and the answer is the session's status. A session that already ended answers 409 session_closed.
curl -sS -X POST "https://api.rupam.ai/v2/sessions/$SES_ID/cancel" \
-H "Authorization: Bearer $RUPAM_KEY"Record a withdrawal of consent
/v2/sessions/{ses_id}/consent-recordsWhen the person withdraws consent through you, record it here, on an open or ended session. Send exactly one record per call. Purposes: analysis, history, evaluation, training, recommendations, marketing, push.
curl -sS -X POST "https://api.rupam.ai/v2/sessions/$SES_ID/consent-records" \
-H "Authorization: Bearer $RUPAM_KEY" -H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"records": [{"purpose": "analysis", "event": "withdrawn"}]}'
# 201: {"consent_ids": ["cns_..."]}, or [] when nothing was in use to withdrawRedeem a result handle
/v2/sessions/{ses_id}/redeemFor flows where the person goes to Rupam's capture page and comes back to your site with a result_handle in the URL. Your server swaps the handle for the result, once, within 15 minutes. Every failure answers 400 result_handle_invalid; after that, read the result with GET …/result. API integrations don't need this call.
curl -sS -X POST "https://api.rupam.ai/v2/sessions/$SES_ID/redeem" \
-H "Authorization: Bearer $RUPAM_KEY" \
-H "Content-Type: application/json" \
-d '{"result_handle": "..."}'Read the workflow's setup
/v2/sessions/bootstrapThe published workflow's offered languages, chosen language and the keys and types of its steps, before any session exists. With a publishable key, also the allowed origins. Writes nothing.
Usage and plans
Read your usage
/v2/usageGive either period_id, or from and to (date-times at most 400 days apart; anything else is 400 range_unbounded). group_by is meter (the default), project, integration or day. A key sees only its own integration's rows. Only billed units are counted.
curl -sS "https://api.rupam.ai/v2/usage?from=2026-11-01T00:00:00Z&to=2026-11-23T00:00:00Z&group_by=day" \
-H "Authorization: Bearer $RUPAM_KEY"Response
{
"current_period": { "period_id": "...", "allowance": 10000, "used": 1240, "reserved": 2, "remaining": 8758 },
"rows": [
{ "day": "2026-11-22", "meter": "session", "project_id": "prj_...", "integration_id": "int_...", "units": 57, "preview_units": 0, "assisted_units": 0 }
],
"time_zone": "Asia/Kolkata"
}List the plans
/v2/plansThe plans on sale, each with plan_key, version, its prices with and without GST, extra-scan rates per 1,000, its modules and quantities (limits).
Conditions Reference
skin_result.conditions[] holds only the conditions in your plan, each under its key. skin_type and skin_tone are in skin_profile on every plan.
| Condition | key | From plan | Notes |
|---|---|---|---|
| Acne | acne | Free | Visible spots. The overlay outlines them. |
| Pores | pores | Free | Visible pores. |
| Dark circles | dark_circles | Free | Under-eye area, both eyes. |
| Pigmentation | pigmentation | Free | Uneven tone and spots. |
| Wrinkles | wrinkles | Starter | Score reflects visible wrinkles. |
| Oiliness | oiliness | Starter | Visible shine. |
| Redness | redness | Starter | Visible redness on cheeks and nose, measured against the person's own skin. |
| Texture | texture | Starter | Surface smoothness. |
| Skin age | skin_age | Growth | Show age_estimate and age_range instead of the score. It is an apparent age from visible signs. No overlay. |
| Fine lines | fine_lines | Growth | Early lines around the eyes and forehead. |
| Eye bags | eye_bags | Growth | Visible under-eye puffiness. |
| Blackheads | blackheads | Growth | Visible blackheads. |
| Hydration | hydration | Professional | Visible dryness. It is not a measure of skin moisture. |
| Moles | moles | Professional | Visible moles only; not a health assessment. No overlay. |
| Skin glow | skin_glow | Professional | Visible radiance. |
skin_age and moles never have an overlay. All other conditions do.Using the Results Responsibly
- The results are cosmetic, not medical. Describe them as an assessment of visible skin features. Do not present them as a diagnosis or a treatment recommendation.
- Say that the result comes from AI. Where you show a result or a suggestion, show that it was produced by an automated analysis, and show the
disclaimerwhen you use product recommendations. - A face photo is personal data, and the person decides. Show the person the notice from
current_renderand send the decision they actually made. Never answer the notice or the age check for them. Send only what you need. - Treat the skin tone as an estimate. Do not use it to make decisions about a person.
This is guidance for building with the API, not legal advice. See our Privacy Policy and Terms.
Error Responses
Every error is application/problem+json (RFC 9457) with a stable code. Branch on code, never on title. Every answer, error or not, carries a Rupam-Request-Id header: quote it when you contact us.
HTTP/1.1 422 Unprocessable Content
Content-Type: application/problem+json
Rupam-Request-Id: req_...
{
"type": "about:blank",
"title": "Unprocessable Content",
"status": 422,
"code": "validation_failed",
"request_id": "req_...",
"errors": [{ "field": "/return_url", "code": "..." }]
}errors[] names each wrong field by JSON pointer (/return_url). On limit_reached the problem also has reason and, where the limit has an end, resets_at (see Rate limits).
Codes you will meet
| HTTP | code | What it means and what to do |
|---|---|---|
| 400 | idempotency_key_required | This POST needs an Idempotency-Key header. Every creating POST does. |
| 400 | result_handle_invalid | The result handle is spent, expired or not this session's. Read the result with GET …/result instead. |
| 401 | invalid_credential | The key is unknown, revoked, expired or badly formed. |
| 401 | token_audience | This route is for people signed in to the dashboard, not for keys. |
| 403 | scope_missing | This key may not make this call (for example a publishable key answering a step). |
| 403 | key_scope_exceeded | The key reached outside its own integration. |
| 403 | create_way_not_allowed | This integration does not start sessions this way. |
| 403 | origin_not_allowed | A publishable key was used from a site that is not in the integration's allowed origins. |
| 403 | module_not_in_plan | Your plan does not include this channel or feature. |
| 403 | org_suspended | The account is suspended, usually after a failed payment. The account holder must settle it in the dashboard. |
| 403 | limit_reached | A usage limit was reached. reason says which; resets_at says when it lifts. |
| 404 | session_not_found | No such session for this key. |
| 404 | integration_not_found | The integration is unknown or switched off. |
| 409 | session_closed | The session has ended. Start a new one. |
| 409 | result_not_ready | The session has no result yet, or ended without one. Read the session's status. |
| 409 | integration_has_no_workflow | No workflow is live on the integration. Choose one on its page in the dashboard. |
| 409 | idempotency_secret_not_replayable | The first answer held a secret (an upload grant), so it cannot be replayed. Use a new Idempotency-Key. |
| 422 | validation_failed | A field is wrong. errors[] names each one by JSON pointer. |
| 422 | idempotency_key_reused | The Idempotency-Key was already used for a different request. |
| 429 | create_ceiling | Too many sessions started on this integration this minute. Wait Retry-After seconds. |
| 429 | rate_limited | Too many requests from this key. Wait Retry-After seconds. |
| 500 | internal_error | Something failed on our side. Retry once, then quote the request_id to us. |
| 503 | entitlements_unavailable | Your plan could not be checked just now. Retry after Retry-After. |
| 503 | service_busy | Rupam is busy. Retry after Retry-After. |
Other codes exist and more may be added; treat an unknown code by its HTTP status.
What to retry
| Status | Retry? |
|---|---|
409 result_not_ready | Yes, after reading the session again |
429, 503 | Yes, after the number of seconds in Retry-After |
500 | Once, with the same Idempotency-Key, then contact us with the request ID |
400, 401, 403, 404, other 409, 422 | No. Fix the cause first |
Rate Limits and Quotas
| Limit | Counts | Answer | Free | Starter | Growth | Professional |
|---|---|---|---|---|---|---|
| Per minute | Sessions started on one integration | 429 create_ceiling | 10 | 50 | 150 | 500 |
| Per day | Sessions on the whole account | 403 limit_reached | 100 | 500 | 2,000 | 8,000 |
| Per plan period | Scans on the whole account | 403 limit_reached | 150 | 2,500 | 10,000 | 50,000 |
- There is no hourly limit.
- Short bursts are limited per key too:
429 rate_limited. - Every 429 and 503 carries
Retry-After(seconds). When a limit applies, answers also carryRateLimit-PolicyandRateLimit(IETF draft 11). - The plan period starts on the day your plan started. With extra scans switched on (Starter and above), scans go on past the period's allowance up to the ceiling you set.
RateLimit-Policy: "default";q=<quota>;w=<window seconds>
RateLimit: "default";r=<remaining>;t=<seconds until reset>
Retry-After: <seconds> # on every 429 and 503The reason on limit_reached
| reason | Meaning |
|---|---|
org_allowance | The plan period's scans are used up (and extra scans are off). |
overage_ceiling | The extra-scan ceiling you set in the dashboard is reached. |
customer_cap | A spending cap set on the account is reached. |
org_daily_ceiling | The plan's daily limit is reached. |
no_active_plan | The account has no active plan. |
HTTP/1.1 403 Forbidden
Content-Type: application/problem+json
{
"type": "about:blank",
"title": "Forbidden",
"status": 403,
"code": "limit_reached",
"reason": "org_daily_ceiling",
"resets_at": { "utc": "2026-11-24T00:00:00Z", "local": "2026-11-24T05:30:00+05:30", "time_zone": "Asia/Kolkata" },
"request_id": "req_...",
"errors": []
}Webhooks
GET /v2/sessions/{ses_id} every poll_after_ms. This section will describe webhooks when they ship.Quick Start Example
One complete scan on an API integration: start a session, then answer each step the session asks for — age check, notice, photo, result — until it ends. The scripts ask the questions in your terminal, standing in for your app. Download one and run it with your key in RUPAM_KEY and a face photo. Available in cURL (with jq), Python and JavaScript. It is a real scan and counts against your plan.
#!/usr/bin/env bash
# Rupam API v2 quick start: one skin scan, driven from your server.
# Needs: curl, jq and uuidgen. Usage: RUPAM_KEY=rsk_... ./quickstart-v2.sh face.jpg
# The key is a secret key (rsk_) of an API integration. Keep it on your server.
set -euo pipefail
API="${RUPAM_API:-https://api.rupam.ai}"
KEY="${RUPAM_KEY:?set RUPAM_KEY to your secret key (rsk_...)}"
PHOTO="${1:?usage: $0 face.jpg}"
case "$PHOTO" in *.png) TYPE="image/png" ;; *) TYPE="image/jpeg" ;; esac
call() { # call METHOD PATH [JSON]: one API call; a new Idempotency-Key on every POST
local method=$1 path=$2 body=${3:-'{}'}
local args=(-sS -X "$method" "$API$path" -H "Authorization: Bearer $KEY")
if [ "$method" = POST ]; then args+=(-H "Idempotency-Key: $(uuidgen)" -H "Content-Type: application/json" -d "$body"); fi
local out code
out=$(curl "${args[@]}" -w $'\n%{http_code}')
code=${out##*$'\n'}; out=${out%$'\n'*}
if [ "${code:0:1}" != 2 ]; then echo "$method $path -> $code $(echo "$out" | jq -r '.code // .')" >&2; exit 1; fi
echo "$out"
}
# 1. Start a session. The key's integration and its live workflow decide the steps.
SES_ID=$(call POST /v2/sessions '{}' | jq -r .session.id)
S="/v2/sessions/$SES_ID"
echo "session $SES_ID"
# 2. Answer each step the session asks for, until it ends.
WAITS=0
while :; do
ST=$(call GET "$S")
STATUS=$(echo "$ST" | jq -r .status)
if [ "$STATUS" != created ] && [ "$STATUS" != active ]; then
echo "session ended: $STATUS $(echo "$ST" | jq -r '.outcome // ""')"; break
fi
STEP=$(echo "$ST" | jq -r '.current_step // ""')
KIND=$(echo "$ST" | jq -r '.current_step_type // ""')
RUN=$(echo "$ST" | jq -r '.step_run_status // ""')
if [ "$STATUS" = created ] && [ -z "$STEP" ]; then
STEP="__age_gate"; KIND="rupam.age_gate" # a new session starts at the age check
elif [ "$STATUS" != created ] && [ "$RUN" != awaiting_input ]; then
WAITS=$((WAITS + 1)) # Rupam is working (photo check, scan)
if [ "$WAITS" -gt 300 ]; then echo "the session did not move on: read it again later" >&2; exit 1; fi
sleep "$(echo "$ST" | jq -r '((.poll_after_ms // 2000) / 1000)')"; continue
fi
WAITS=0
case "$KIND" in
rupam.age_gate*)
read -r -p "Age bracket (under_18, 18-24, 25-34, 35-44, 45-54, 55+, unknown): " BRACKET
call POST "$S/steps" "$(jq -nc --arg s "$STEP" --arg b "$BRACKET" '{step_key: $s, input: {bracket: $b}}')" >/dev/null ;;
rupam.notice_consent*)
echo "$ST" | jq -r .current_render.text
read -r -p "Does the person agree? (granted/declined): " DECISION
call POST "$S/steps" "$(jq -nc --arg s "$STEP" --arg d "$DECISION" '{step_key: $s, input: {decision: $d}}')" >/dev/null ;;
rupam.capture_selfie*)
RETAKE=$(echo "$ST" | jq -r '.retake // ""')
if [ -n "$RETAKE" ]; then echo "the photo was refused ($RETAKE): take a new one and run again" >&2; exit 1; fi
GRANT=$(call POST "$S/upload-grants" "{\"content_type\": \"$TYPE\"}")
URL=$(echo "$GRANT" | jq -r .url)
if [ "$(echo "$GRANT" | jq -r .method)" = POST ]; then
FORM=(); while IFS= read -r kv; do FORM+=(--form-string "$kv"); done < <(echo "$GRANT" | jq -r '.fields | to_entries[] | "\(.key)=\(.value)"')
curl -sS --fail -X POST "$URL" "${FORM[@]}" -F "file=@$PHOTO;type=$TYPE" >/dev/null
else
HDRS=(); while IFS= read -r kv; do HDRS+=(-H "$kv"); done < <(echo "$GRANT" | jq -r '.fields | to_entries[] | "\(.key): \(.value)"')
curl -sS --fail -X PUT "$URL" "${HDRS[@]}" --data-binary "@$PHOTO" >/dev/null
fi
call POST "$S/steps" "$(jq -nc --arg s "$STEP" --arg u "$(echo "$GRANT" | jq -r .upload_id)" '{step_key: $s, input: {upload_id: $u}}')" >/dev/null ;;
rupam.result*)
call GET "$S/result" | jq '.skin_result | {overall, conditions: [.conditions[] | {key, score, grade}]}'
call POST "$S/steps" "$(jq -nc --arg s "$STEP" '{step_key: $s, input: {shown: true}}')" >/dev/null ;;
*)
echo "step $STEP ($KIND) is not handled by this example" >&2; exit 1 ;;
esac
done
API Playground
The API does not run in this page: a secret key belongs on your server, and sessions do not answer other websites. Fill in the values as you go and copy each command into your terminal. Nothing you type here leaves the page.
From step 2. Leave empty to keep $SES_ID.
current_step while the session waits for the photo.
upload_id from the grant in step 5.
current_step once the scan is done (also result_step in the result).
1. Set your key in your terminal
Your secret key stays in your own shell. Never paste it into a web page.
bashexport RUPAM_KEY="rsk_..." # your secret key2. Start a session
Copy session.id from the answer into the Session ID field above.
bashcurl -sS -X POST "https://api.rupam.ai/v2/sessions" \ -H "Authorization: Bearer $RUPAM_KEY" -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{}'3. Answer the age check
Ask the person. Never guess the bracket.
bashcurl -sS -X POST "https://api.rupam.ai/v2/sessions/$SES_ID/steps" \ -H "Authorization: Bearer $RUPAM_KEY" -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"step_key": "__age_gate", "input": {"bracket": "25-34"}}'4. Read the notice, then send the person's decision
Show current_render.text to the person first.
bashcurl -sS "https://api.rupam.ai/v2/sessions/$SES_ID" -H "Authorization: Bearer $RUPAM_KEY" curl -sS -X POST "https://api.rupam.ai/v2/sessions/$SES_ID/steps" \ -H "Authorization: Bearer $RUPAM_KEY" -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"step_key": "__notice_consent", "input": {"decision": "granted"}}'5. Take an upload grant and send the photo
Use the url and fields from the grant. One --form-string per entry of fields; no Authorization header on the upload.
bashcurl -sS -X POST "https://api.rupam.ai/v2/sessions/$SES_ID/upload-grants" \ -H "Authorization: Bearer $RUPAM_KEY" -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"content_type": "image/jpeg"}' curl -sS -X POST "<url from the grant>" \ --form-string "<field>=<value>" \ -F "file=@face.jpg;type=image/jpeg"6. Answer the photo step
The step key is the session's current_step while it waits for the photo.
bashcurl -sS -X POST "https://api.rupam.ai/v2/sessions/$SES_ID/steps" \ -H "Authorization: Bearer $RUPAM_KEY" -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"step_key": "<photo step>", "input": {"upload_id": "upl_..."}}'7. Wait for the scan, then read the result
Read the session every poll_after_ms until current_step is the result step.
bashcurl -sS "https://api.rupam.ai/v2/sessions/$SES_ID" -H "Authorization: Bearer $RUPAM_KEY" curl -sS "https://api.rupam.ai/v2/sessions/$SES_ID/result" -H "Authorization: Bearer $RUPAM_KEY"8. Confirm the result was shown
The session ends with outcome result_delivered. The result stays readable.
bashcurl -sS -X POST "https://api.rupam.ai/v2/sessions/$SES_ID/steps" \ -H "Authorization: Bearer $RUPAM_KEY" -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"step_key": "<result step>", "input": {"shown": true}}'
Other Ways to Integrate
The REST API is not the only route. If you would rather not write server code:
| Option | What it is |
|---|---|
| Shopify plugin | Skin analysis and product recommendations on your Shopify store, installed without code. Available on the paid plans. |
| Embed and Redirect | Rupam's own scan page on your site, or a hand-off to it and back. Set up in the dashboard, under Integrations. |
| White-label engine | A custom-branded deployment for larger brands. |
| Talk to us | For other integration needs. |
Getting help
When you write to us, include the Rupam-Request-Id header (or the problem's request_id), the session ID, the time in UTC, the endpoint, the HTTP status and your plan. Never send your API key or a face photo by email.
/v2). Changes inside /v2 only add things, so your code must ignore fields and values it does not know. A route that is going away first answers Deprecation and Sunset headers.Ready to integrate?
Create a secret key and start analysing skin in minutes.