This document describes the MedicalAnswer API. The service searches an authoritative medical database and uses a large language model (LLM) to generate professional, summarized answers. Compared to standard search engines, it delivers more comprehensive and professional results. It can also understand and answer a wide range of conversational questions, such as "Why do I get motion sickness?", "What should I do for a stomachache?", and "Is sugar-free soda healthy?".
API definition
Request parameters
Parameter | Type | Required | Default | Description | Example | |
query | string | Yes | - | The search query. The query must be 1 to 200 characters long. Important For optimal performance, limit the query to 30 characters. You can use a client-side model to rewrite the query before calling the API. | What should I do for a stomachache? | |
Response parameters
Field | Type | Nullable | Description | Example | ||||
requestId | string | No | The request ID. Provide this ID for troubleshooting. | 35E5608A-A737-2038-****-D9D34C6BFD9E | ||||
messages[] | content | string | No | The summarized answer. | There are many causes of a stomachache, and the appropriate remedy depends on the specific cause and symptom severity. Here are some common relief measures: 1. Temporarily stop eating: If the abdominal pain is caused by diet (such as overeating or consuming spicy and greasy foods), you can stop eating to let your stomach and intestines rest and avoid further irritation[3][7]. 2. Apply heat or massage the abdomen: This is suitable for mild abdominal pain, such as cramps caused by cold or minor indigestion. | |||
metaData | raDocList[] | title | string | No | The title of the source document. | What to do for a stomachache? These tips will help you find quick relief! | ||
rawUrl | string | Yes | The URL of the source document. | |||||
content | string | Yes | The content of the source document. | There are many causes of a stomachache, and improper diet is one of the most common. | ||||
searchInformation | searchTime | int64 | No | The search duration. | 500 | |||
queryContext | originalQuery | query | string | No | The original query. | What should I do for a stomachache? | ||
The server-side timeout is 5 seconds.
Example
Request body
{
"query": "What should I do for a stomachache?"
}Response body
{
"requestId": "ea42f9********1fa8",
"messages": [
{
"content": "There are many causes of a stomachache, and the appropriate remedy depends on the specific cause and symptom severity. Here are some common relief measures: 1. **Temporarily stop eating**: If the abdominal pain is caused by diet (such as overeating or consuming spicy and greasy foods), you can stop eating to let your stomach and intestines rest and avoid further irritation[3][7]. 2. **Apply heat or massage the abdomen**: This is suitable for mild abdominal pain, such as cramps caused by cold or minor indigestion. You can use a hot water bottle (at a moderate temperature to avoid burns) or gently massage your abdomen clockwise to promote blood circulation and gastrointestinal motility, which can relieve discomfort[2][5][6][8]. 3. **Adjust your posture**: Try lying flat, on your side, or with your knees bent. Changing your body position may reduce abdominal pressure and relieve pain. 4. **Replenish fluids and electrolytes**: If the abdominal pain is accompanied by diarrhea or vomiting, drink warm water or an oral rehydration solution in small, frequent sips to prevent dehydration. 5. **Medication**: - **Antispasmodics**: such as pinaverium bromide and scopolamine, are suitable for pain caused by gastrointestinal spasms and can relieve smooth muscle cramps[9]. - **Acid suppressants**: such as omeprazole, are suitable for pain caused by gastric ulcers or gastritis due to excessive stomach acid. They can reduce stomach acid secretion and protect the gastric mucosa[10].",
"metaData": {
"raDocList": [
{
"title": "How to Effectively Relieve Acute Abdominal Pain",
"rawUrl": "",
"content": "",
"type": "paper_source"
},
{
"title": "How to quickly and easily stop a stomach ache - Youlai Doctor",
"rawUrl": "https://www.youlai.cn/sjingbian/article/4CD364Mm8hh.html",
"content": "Stomach pain has many causes, including gastrointestinal spasms, inflammation, urinary system stones, and menstrual pain in women. Treatment methods include applying heat to the abdomen, taking medication, and other remedies.\n1. Abdominal heat application: For pain caused by gastrointestinal spasms, applying heat is a common method. Apply a warm towel or hot water bottle to the painful area of the abdomen. The heat can promote abdominal blood circulation and relax tense muscles, thereby relieving spasms and reducing pain. Use a moderate temperature to avoid skin burns. Applying heat for 15-20 minutes can provide temporary comfort.\n2. Moderate exercise: For abdominal bloating and pain caused by indigestion, moderate activity can promote gastrointestinal motility. Simple exercises like slow walking can help digestion and relieve discomfort caused by food accumulation in the gastrointestinal tract. However, the intensity of the exercise should not be too high; it should be within what your body can tolerate. A slow walk for 10-15 minutes may alleviate the abdominal pain.\n3. Medication: If the cause of the abdominal pain is clear and medication is appropriate, some over-the-counter drugs can relieve the pain. For example, under a doctor's guidance, non-steroidal anti-inflammatory drugs (NSAIDs) can inhibit the substances in the body that cause pain and inflammation. However, they must be taken correctly according to the instructions or the pharmacist's guidance. Do not exceed the dosage to avoid adverse reactions. Special populations such as pregnant and lactating women should use them with caution.\n4. Relaxation: Stress can worsen abdominal pain. Find a quiet and comfortable place to sit or lie down, close your eyes, focus on your breathing, slowly relax your whole body, clear your mind, and let your body and mind relax.",
"type": "med_web_source"
},
{
"title": "Abdominal Pain Treatment",
"rawUrl": "https://p.quark.cn/0387f345/index?uc_biz_str=OPT%3ABACK_BTN_STYLE%400%7COPT%3AIMMERSIVE%401&uc_param_str=dnntnwvepffrbijbprsvchgputdemennosstodcaaapcgidsdieinipixsnxkp&struct_id=VdB%2BLV7w7lHHEp%2Fo7ZfF0MPzbC8lOOFONeJlmo5h8egX%2B%2Bq0sb0ZO%2BzKAYTVoBfV&struct_type=VdB%2BLV7w7lHHEp%2Fo7ZfF0NZHIEQu2g6JAcUdFLkRPzM%3D&token=917796181759&version=v1&skip_cache=0",
"content": "",
"type": "med_knowledge_source"
},
{
"title": "Fastest way to relieve stomach cramps - Youlai Doctor",
"rawUrl": "https://www.youlai.cn/sjingbian/article/ADB24BgsYlE.html",
"content": "The fastest way to relieve stomach cramps depends on the cause and includes applying heat and massage, adjusting your diet, taking medication, and surgery. It is recommended to seek treatment under the guidance of a professional doctor to quickly relieve stomach cramps and protect your health.\n1. Heat application and massage: For stomach cramps caused by abdominal cold or mild indigestion, applying heat and gentle massage are simple and effective relief methods. Apply a hot water bottle or hot towel to the abdomen to promote blood circulation, and gently massage the abdomen in a clockwise direction to help relieve muscle spasms and reduce pain. This is suitable for mild symptoms not accompanied by other serious symptoms.\n2. Diet adjustment: When the pain is caused by mild food irritation or indigestion, you should immediately adjust your diet. Avoid spicy, greasy, raw, and cold irritating foods, and switch to a light and easily digestible diet, such as millet porridge and steamed egg custard. Getting adequate rest and avoiding strenuous exercise also helps the body recover and reduces pain.\n3. Medication: If the cramps are caused by gastric diseases such as gastritis or gastric ulcers and the symptoms are significant, you can use antacids, gastric mucosa protectants, and other drugs under a doctor's guidance. These can quickly neutralize stomach acid and protect the gastric mucosa, thereby reducing pain. For stomach cramps caused by more serious diseases such as acute gastroenteritis or appendicitis, it is recommended to use antibiotics to control the infection as prescribed by a doctor.",
"type": "med_web_source"
},
{
"title": "Standardized Use of Antispasmodic and Analgesic Drugs for Acute Abdominal Pain & Selection and Application Indications of Antispasmodic and Analgesic Drugs",
"rawUrl": "",
"content": "",
"type": "guide_source"
},
{
"title": "Primary Care Guidelines for Peptic Ulcer (2023) - Treatment",
"rawUrl": "",
"content": "",
"type": "guide_source"
}
]
}
}
],
"searchInformation": {
"searchTime": 342
},
"queryContext": {
"originalQuery": {
"query": "What should I do for a stomachache?"
}
}
}Error codes
Status | Error code | Error message | Solution |
404 | InvalidAccessKeyId.NotFound | The specified access key was not found. | Verify that the AccessKey and Secret are correct. |
403 | Retrieval.NotActivate | The AI search service is not activated. | Place an order or contact your account manager to activate the service. |
403 | Retrieval.Arrears | Insufficient account balance. | Please top up your account. |
403 | Retrieval.NotAuthorised | The RAM user does not have the AliyunIQSFullAccess permission. | Grant the required permission to the RAM user. See Create a RAM user and grant permissions. |
403 | Retrieval.TestUserPeriodExpired | The test period has expired. | The trial period has expired (valid for 15 days after you place the order). Contact your account manager to upgrade to a paid plan. |
429 | Retrieval.Throttling.User | Request rate limit exceeded. | The rate limit has been exceeded. Contact your account manager to increase your rate limit or upgrade your plan. |
429 | Retrieval.TestUserQueryExceeded | The query count exceeds the limit | The daily query limit for the trial (1,000 queries/day) has been exceeded. Contact your account manager to upgrade to a paid plan. |
API calls
HTTP call
To make HTTP API calls, authenticate your requests with an API-KEY from Information Query Service (IQS). To get an API-KEY, see Create and view your API-KEY.
curl -X POST https://cloud-iqs.aliyuncs.com/medical/answer \
--header "Authorization: Bearer $API_KEY" \
--header "Content-Type: application/json" \
--data '{
"query": "What should I do for a stomachache?"
}'
Replace $API_KEY with the API-KEY you created in the IQS console (see Create and view your API-KEY). A new API-KEY may take up to 5 minutes to become active.
MCP call
For MCP integration, see MCP access.