Create an image-recognition session
POST
/session-records/sessionsCreates an image-recognition session. The session is bound to pet_profile_id, sub_module_type, lang and the first image asset, and those cannot be changed afterwards.
Request URL
text
POST https://open-api.habitaxx.com/v1/ms-ai-fast/session-records/sessionsRequest headers
http
Authorization: Bearer <ACCESS_TOKEN>
Content-Type: application/jsonRequest body
json
{
"module_type": 5,
"pet_profile_id": 44,
"sub_module_type": 6,
"lang": "en-US",
"trace_id": "pic-demo-20260914-0001"
}Request fields
| Field | Type | Required | Description |
|---|---|---|---|
module_type | integer | Yes | Always 5 for image recognition. |
pet_profile_id | integer | Yes | Numeric pet-profile ID. |
sub_module_type | integer | No | Image-recognition subtype: 1 breed, 2 expression, 3 oral/dental, 4 faeces, 5 vomit, 6 skin, 7 ear canal, 8 eye. The schema allows omitting it, but the later image steps require the value locked into the session, so send it in practice; it cannot be changed after creation. |
lang | string | No | Session language; defaults to zh-CN. |
trace_id | string | No | Client trace identifier. |
content | string/null | No | Normally omitted for image recognition. |
Response example
json
{
"code": 200,
"message": "success",
"data": {
"session_id": "pic_<SESSION_ID>",
"medical_record_id": 10001,
"medical_record": {
"id": 10001,
"created_at": "2026-09-14T10:00:00+08:00",
"updated_at": "2026-09-14T10:00:00+08:00",
"session_id": "pic_<SESSION_ID>",
"user_uuid": "<USER_UUID>",
"pet_profile_id": 44,
"module_type": 5,
"sub_module_type": 6,
"stage": null,
"status": 2,
"is_paid": 0,
"is_del": 0,
"report_status": 0,
"image_recognition_status": 0,
"report_type": "v1",
"lang": "en-US",
"summary": null,
"report_url": null,
"report_time": null,
"trace_id": "pic-demo-20260914-0001"
},
"initial_message": null
}
}Response fields
| Field | Type | Description |
|---|---|---|
session_id | string | Image-recognition session ID; the core credential for all later steps. |
medical_record_id | integer/null | Main AI record ID. |
medical_record | object/null | Created AI record. See full report fields. |
medical_record.id | integer | Record primary key. |
medical_record.pet_profile_id | integer | Bound pet-profile ID. |
medical_record.module_type | integer | 5 for image recognition. |
medical_record.status | integer | Business status; 2 means active. |
medical_record.lang | string | Language locked into this session. |
medical_record.created_at / updated_at | string | Record creation and update time (UTC+8, no offset). |
initial_message | object/null | First message when content is supplied; null in this example because content was omitted. |
Common errors
HTTP / code | message | Trigger |
|---|---|---|
400 | 缺少宠物档案ID | pet_profile_id was not sent. |
400 | 语言尚未启用: <lang> | lang is not enabled in this environment; call GET /locales first. |
400 | 不支持的AI模块类型 | module_type is not 5. |