مرجع API
مسیرها، پارامترها، نمونهٔ درخواست و پاسخ.
آدرس پایه: https://api.sarovi.ir/v1. کلید ساروی را با Authorization: Bearer بفرستید؛ مسیر /messages هدر x-api-key را هم میپذیرد و به anthropic-version: 2023-06-01 نیاز دارد.
یک مسیر را جستجو یا گروه آن را انتخاب کنید. شناسهٔ پیگیری هر درخواست در هدر X-Request-ID برمیگردد.
۹۷ مسیر · دریافت OpenAPI
GET/v1/models
فهرست مدلها و مسیرهای قابل استفاده
Required scope: models:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیرنمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/models",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "فهرست مدلها و مسیرهای قابل استفاده",
"description": "Required scope: models:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "get__v1_models",
"security": [
{
"BearerAuth": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"models"
]
}POST/v1/chat/completions
Chat with text, images, inline audio/video, function tools and structured outputs
Select thinking intensity with reasoning.effort (or reasoning_effort). Discover the exact supported values per model in GET /v1/models reasoning.supported_efforts. Omit both fields for automatic behavior. Unsupported values and conflicting aliases return HTTP 400 before credits are reserved. Higher effort may take longer and consume more output tokens within the request token limit. include_reasoning controls visibility separately.
پیوند این مسیربدنهٔ درخواست
modelstringoptionalMaximum length: 200
Default: "z-ai/glm-5.3-flash"
messagesarrayrequiredMinimum items: 1
Maximum items: 1000
ساختار داخلی
rolestringrequiredValues: system · developer · user · assistant · tool
contentobject | nulloptionalساختار داخلی
قالب 1
قالب 1
string
قالب 2
Array
قالب 2
null
refusalstring | nulloptionalساختار داخلی
قالب 1
string
قالب 2
null
namestringoptionaltool_call_idstringoptionalMaximum length: 200
tool_callsarrayoptionalMaximum items: 128
ساختار داخلی
idstringrequiredMinimum length: 1
Maximum length: 200
indexintegeroptionalMinimum: 0
Maximum: 127
typestringrequiredValue: "function"
functionobjectrequiredساختار داخلی
namestringrequiredargumentsstringrequiredMaximum length: 1000000
reasoningstring | nulloptionalساختار داخلی
قالب 1
string
قالب 2
null
reasoning_contentstring | nulloptionalساختار داخلی
قالب 1
string
قالب 2
null
reasoning_detailsarrayoptionalMaximum items: 100
ساختار داخلی
object
toolsarrayoptionalMaximum items: 128
ساختار داخلی
typestringrequiredValue: "function"
functionobjectrequiredساختار داخلی
namestringrequireddescriptionstringoptionalMaximum length: 16000
parametersobjectrequiredstrictbooleanoptionaltool_choicestring | objectoptionalساختار داخلی
قالب 1
string
قالب 2
typestringrequiredValue: "function"
functionobjectrequiredساختار داخلی
namestringrequiredparallel_tool_callsbooleanoptionalresponse_formatobject | object | objectoptionalساختار داخلی
قالب 1
typestringrequiredValue: "text"
قالب 2
typestringrequiredValue: "json_object"
قالب 3
typestringrequiredValue: "json_schema"
json_schemaobjectrequiredساختار داخلی
namestringrequireddescriptionstringoptionalMaximum length: 16000
schemaobjectrequiredstrictbooleanoptionalDefault: true
streambooleanoptionalDefault: false
stream_optionsobjectoptionalساختار داخلی
include_usagebooleanoptionalmax_tokensintegeroptionalMinimum: 1
Maximum: 32768
max_completion_tokensintegeroptionalMinimum: 1
Maximum: 32768
temperaturenumberoptionalMinimum: 0
Maximum: 2
top_pnumberoptionalMinimum: 0
Maximum: 1
top_kintegeroptionalMinimum: 0
Maximum: 9007199254740991
repetition_penaltynumberoptionalMinimum: 0
Maximum: 2
seedintegeroptionalMinimum: -9007199254740991
Maximum: 9007199254740991
stopstring | arrayoptionalساختار داخلی
قالب 1
string
قالب 2
Array
frequency_penaltynumberoptionalMinimum: -2
Maximum: 2
presence_penaltynumberoptionalMinimum: -2
Maximum: 2
reasoning_effortstringoptionalreasoningobjectoptionalساختار داخلی
effortstringoptionalmax_tokensintegeroptionalMinimum: 1
Maximum: 32768
excludebooleanoptionalenabledbooleanoptionalnnumberoptionalValue: 1
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
},
{
"name": "X-Customer-ID",
"in": "header",
"schema": {
"type": "string",
"maxLength": 120
},
"description": "Your internal customer or record ID for usage reconciliation; do not include personal information."
},
{
"name": "X-Reference-ID",
"in": "header",
"schema": {
"type": "string",
"maxLength": 120
},
"description": "Your internal customer or record ID for usage reconciliation; do not include personal information."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/chat/completions",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
OpenAI-compatible completion or SSE; tool execution remains in the client.
idstringrequiredobjectobjectrequiredValue: "chat.completion"
createdintegeroptionalMinimum: 0
modelstringrequiredchoicesarrayrequiredساختار داخلی
indexintegerrequiredMinimum: 0
messageobjectrequiredساختار داخلی
roleobjectrequiredValue: "assistant"
contentstring | nulloptionaltool_callsarrayoptionalساختار داخلی
idstringrequiredtypeobjectrequiredValue: "function"
functionobjectrequiredساختار داخلی
namestringrequiredargumentsstringrequiredrefusalstring | nulloptionalfinish_reasonstring | nullrequiredusageobjectrequiredساختار داخلی
prompt_tokensintegerrequiredMinimum: 0
completion_tokensintegerrequiredMinimum: 0
total_tokensintegerrequiredMinimum: 0
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "Chat with text, images, inline audio/video, function tools and structured outputs",
"description": "Select thinking intensity with reasoning.effort (or reasoning_effort). Discover the exact supported values per model in GET /v1/models reasoning.supported_efforts. Omit both fields for automatic behavior. Unsupported values and conflicting aliases return HTTP 400 before credits are reserved. Higher effort may take longer and consume more output tokens within the request token limit. include_reasoning controls visibility separately.",
"operationId": "post__v1_chat_completions",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
},
{
"name": "X-Customer-ID",
"in": "header",
"schema": {
"type": "string",
"maxLength": 120
},
"description": "Your internal customer or record ID for usage reconciliation; do not include personal information."
},
{
"name": "X-Reference-ID",
"in": "header",
"schema": {
"type": "string",
"maxLength": 120
},
"description": "Your internal customer or record ID for usage reconciliation; do not include personal information."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ChatCompletionRequest"
}
}
}
},
"responses": {
"200": {
"description": "OpenAI-compatible completion or SSE; tool execution remains in the client.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ChatCompletion"
}
},
"text/event-stream": {
"schema": {
"type": "string"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"chat"
]
}POST/v1/responses
Text or single-image Responses; JSON or SSE
Select thinking intensity with reasoning.effort (or reasoning_effort). Discover the exact supported values per model in GET /v1/models reasoning.supported_efforts. Omit both fields for automatic behavior. Unsupported values and conflicting aliases return HTTP 400 before credits are reserved. Higher effort may take longer and consume more output tokens within the request token limit. include_reasoning controls visibility separately. Text models require responses:write. An image model as the top-level model requires studio:write and returns one image_generation_call with base64 result; optional image_generation settings and stream=true are supported. Chat-model image tools, previous_response_id, remote image URLs and partial images are not supported. See the images guide for supported options.
پیوند این مسیربدنهٔ درخواست
قالب 1
modelstringoptionalValues: google/gemini-4-argon · meta/muse-wonder · inclusionai/ling-3.1-flash · z-ai/glm-5.3-flash · qwen/qwen3.8-flash · anthropic/claude-haiku-5.5 · deepseek/deepseek-v4-flash-0731 · openai/gpt-5.6-luna · openai/gpt-6-luna · google/gemini-3.7-flash · z-ai/glm-5.3 · deepseek/deepseek-v4-pro-0813 · qwen/qwen3.8-max · mistralai/mistral-medium-3-5 · mistralai/mistral-large-4-0 · x-ai/grok-4.6 · openai/gpt-5.6-terra · anthropic/claude-sonnet-5 · openai/gpt-5.6-sol · openai/gpt-6-sol · anthropic/claude-opus-5 · anthropic/claude-opus-5.5 · moonshotai/kimi-k3 · qwen/qwen3.8-2.4t-a95b · anthropic/claude-fable-5 · anthropic/claude-fable-5.1 · openai/gpt-5.5-pro · openai/gpt-6-astra · openai/gpt-6-astra-pro
Default: "z-ai/glm-5.3-flash"
inputstring | arrayrequiredساختار داخلی
قالب 1
string
قالب 2
Array
instructionsstringoptionalMaximum length: 12000
max_output_tokensintegeroptionalDefault: 2048
Minimum: 128
Maximum: 32768
reasoning_effortstringoptionalreasoningobjectoptionalساختار داخلی
effortstringrequiredinclude_reasoningbooleanoptionalDefault: false
streambooleanoptionalDefault: false
web_searchbooleanoptionalDefault: false
قالب 2
modelstringoptionalMaximum length: 200
Default: "z-ai/glm-5.3-flash"
inputstring | arrayrequiredساختار داخلی
قالب 1
string
قالب 2
Array
instructionsstringoptionalMaximum length: 12000
max_output_tokensintegeroptionalDefault: 2048
Minimum: 1
Maximum: 32768
toolsarrayoptionalMaximum items: 128
ساختار داخلی
typestringrequiredValue: "function"
namestringrequireddescriptionstringoptionalMaximum length: 16000
parametersobjectrequiredstrictbooleanoptionaltool_choicestring | objectoptionalساختار داخلی
قالب 1
string
قالب 2
typestringrequiredValue: "function"
namestringrequiredparallel_tool_callsbooleanoptionalstreambooleanoptionalDefault: false
reasoning_effortstringoptionaltextobjectoptionalساختار داخلی
formatobject | object | objectrequiredساختار داخلی
قالب 1
typestringrequiredValue: "text"
قالب 2
typestringrequiredValue: "json_object"
قالب 3
typestringrequiredValue: "json_schema"
namestringrequireddescriptionstringoptionalschemaobjectrequiredstrictbooleanoptionalDefault: true
verbositystringoptionalValues: low · medium · high
reasoningobjectoptionalساختار داخلی
effortstringoptionalsummarystringoptionalValues: auto · concise · detailed
temperaturenumberoptionalMinimum: 0
Maximum: 2
top_pnumberoptionalMinimum: 0
Maximum: 1
storebooleanoptionalValue: false
قالب 3
modelstringrequiredValues: google/gemini-2.5-flash-image · google/gemini-nano-banana-2.1 · tencent/hy-image-v3.5-preview · google/imagen-4.0-fast-generate-001 · google/imagen-4.0-generate-001 · meta/muse-image · bytedance-seed/seedream-5-0-lite · bytedance-seed/seedream-5-0-pro · qwen/qwen-image-3 · krea/krea-2-medium-turbo · google/gemini-3.1-flash-lite-image · google/gemini-3.1-flash-image · google/gemini-3-pro-image · openai/gpt-image-2 · openai/gpt-image-2.5-sunburst · openai/gpt-5.4-image-2
inputstring | arrayrequiredساختار داخلی
قالب 1
string
قالب 2
Array
instructionsstringoptionalMaximum length: 8000
toolsarrayoptionalMaximum items: 1
ساختار داخلی
typestringrequiredValue: "image_generation"
modelstringoptionalValues: google/gemini-2.5-flash-image · google/gemini-nano-banana-2.1 · tencent/hy-image-v3.5-preview · google/imagen-4.0-fast-generate-001 · google/imagen-4.0-generate-001 · meta/muse-image · bytedance-seed/seedream-5-0-lite · bytedance-seed/seedream-5-0-pro · qwen/qwen-image-3 · krea/krea-2-medium-turbo · google/gemini-3.1-flash-lite-image · google/gemini-3.1-flash-image · google/gemini-3-pro-image · openai/gpt-image-2 · openai/gpt-image-2.5-sunburst · openai/gpt-5.4-image-2
qualitystringoptionalValues: auto · low · medium · high
output_formatstringoptionalValues: png · jpeg · webp
backgroundstringoptionalValues: auto · opaque · transparent
sizestringoptionalaspect_ratiostringoptionalMaximum length: 24
fitstringoptionalValues: pad · crop
actionstringoptionalValues: auto · generate · edit
tool_choicestring | objectoptionalساختار داخلی
قالب 1
string
قالب 2
typestringrequiredValue: "image_generation"
streambooleanoptionalDefault: false
storebooleanoptionalValue: false
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
},
{
"name": "X-Customer-ID",
"in": "header",
"schema": {
"type": "string",
"maxLength": 120
},
"description": "Your internal customer or record ID for usage reconciliation; do not include personal information."
},
{
"name": "X-Reference-ID",
"in": "header",
"schema": {
"type": "string",
"maxLength": 120
},
"description": "Your internal customer or record ID for usage reconciliation; do not include personal information."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"model": "z-ai/glm-5.3-flash",
"input": "سلام! در یک جمله خودت را معرفی کن.",
"max_output_tokens": 512
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/responses",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
JSON response (including image_generation_call for image models), or SSE when stream=true: response.output_item.done, response.image_generation_call.completed, response.created, response.output_text.delta, response.reasoning.delta (opt-in), response.tool, response.completed or response.failed.
idstringoptionalobjectobjectoptionalValue: "response"
modelstringoptionalstatusobjectoptionalValues: completed · incomplete
output_textstringoptionalreasoningobjectoptionalPresent only when include_reasoning=true. Provider output; availability varies.
ساختار داخلی
statusobjectoptionalValues: available · unavailable
textstringoptionalformatobjectoptionalValues: summary · text
sourceobjectoptionalValue: "provider"
outputarrayoptionalساختار داخلی
object
usageobjectoptionalساختار داخلی
input_tokensintegeroptionaloutput_tokensintegeroptionaltotal_tokensintegeroptionaldefault
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "Text or single-image Responses; JSON or SSE",
"description": "Select thinking intensity with reasoning.effort (or reasoning_effort). Discover the exact supported values per model in GET /v1/models reasoning.supported_efforts. Omit both fields for automatic behavior. Unsupported values and conflicting aliases return HTTP 400 before credits are reserved. Higher effort may take longer and consume more output tokens within the request token limit. include_reasoning controls visibility separately. Text models require responses:write. An image model as the top-level model requires studio:write and returns one image_generation_call with base64 result; optional image_generation settings and stream=true are supported. Chat-model image tools, previous_response_id, remote image URLs and partial images are not supported. See the images guide for supported options.",
"operationId": "post__v1_responses",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
},
{
"name": "X-Customer-ID",
"in": "header",
"schema": {
"type": "string",
"maxLength": 120
},
"description": "Your internal customer or record ID for usage reconciliation; do not include personal information."
},
{
"name": "X-Reference-ID",
"in": "header",
"schema": {
"type": "string",
"maxLength": 120
},
"description": "Your internal customer or record ID for usage reconciliation; do not include personal information."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ResponseRequest"
},
"example": {
"model": "z-ai/glm-5.3-flash",
"input": "سلام! در یک جمله خودت را معرفی کن.",
"max_output_tokens": 512
}
}
}
},
"responses": {
"200": {
"description": "JSON response (including image_generation_call for image models), or SSE when stream=true: response.output_item.done, response.image_generation_call.completed, response.created, response.output_text.delta, response.reasoning.delta (opt-in), response.tool, response.completed or response.failed.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"object": {
"const": "response"
},
"model": {
"type": "string"
},
"status": {
"enum": [
"completed",
"incomplete"
]
},
"output_text": {
"type": "string"
},
"reasoning": {
"type": "object",
"description": "Present only when include_reasoning=true. Provider output; availability varies.",
"properties": {
"status": {
"enum": [
"available",
"unavailable"
]
},
"text": {
"type": "string"
},
"format": {
"enum": [
"summary",
"text"
]
},
"source": {
"const": "provider"
}
}
},
"output": {
"type": "array",
"items": {
"type": "object"
}
},
"usage": {
"type": "object",
"properties": {
"input_tokens": {
"type": "integer"
},
"output_tokens": {
"type": "integer"
},
"total_tokens": {
"type": "integer"
}
}
}
}
}
},
"text/event-stream": {
"schema": {
"type": "string"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"responses"
]
}POST/v1/studio/image
ساخت image با موتور استودیو
Required scope: studio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
promptstringrequiredMinimum length: 3
Maximum length: 8000
presetstringoptionalValues: fast · balanced · quality
Default: "balanced"
modelstringoptionalValues: google/gemini-2.5-flash-image · google/gemini-nano-banana-2.1 · tencent/hy-image-v3.5-preview · google/imagen-4.0-fast-generate-001 · google/imagen-4.0-generate-001 · meta/muse-image · bytedance-seed/seedream-5-0-lite · bytedance-seed/seedream-5-0-pro · qwen/qwen-image-3 · krea/krea-2-medium-turbo · google/gemini-3.1-flash-lite-image · google/gemini-3.1-flash-image · google/gemini-3-pro-image · openai/gpt-image-2 · openai/gpt-image-2.5-sunburst · openai/gpt-5.4-image-2
aspectRatiostringoptionalauto follows the prompt or reference. Omitted settings preserve the legacy 1:1 default.
Maximum length: 24
sizestringoptionalExact export WIDTHxHEIGHT or auto. Export is resized without distortion; fit defaults to pad.
fitstringoptionalpad preserves the full image with borders; crop fills the requested canvas. Applies to custom export sizes and non-native ratios.
Values: pad · crop
qualitystringoptionalValues: low · medium · high
Default: "medium"
outputFormatstringoptionalValues: png · jpeg · webp
Default: "png"
transparentbooleanoptionalDefault: false
countintegeroptionalDefault: 1
Minimum: 1
Maximum: 4
referenceobjectoptionalساختار داخلی
dataUrlstringrequiredMaximum length: 12000000
referencesarrayoptionalMinimum items: 1
Maximum items: 8
ساختار داخلی
dataUrlstringrequiredMaximum length: 12000000
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"model": "google/gemini-2.5-flash-image",
"prompt": "یک پوستر عمودی از انار سرخ روی میز سنگی، نور نرم پنجره",
"aspectRatio": "auto",
"count": 1
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/studio/image",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
outputsarrayrequiredMinimum items: 1
Maximum items: 4
ساختار داخلی
datastringrequiredMinimum length: 16
Maximum length: 24000000
widthintegeroptionalMaximum: 9007199254740991
heightintegeroptionalMaximum: 9007199254740991
sizingobjectoptionalساختار داخلی
sourcestringrequiredValues: settings · prompt · reference · default
fitstringrequiredValues: native · pad · crop
sourceWidthintegerrequiredMaximum: 9007199254740991
sourceHeightintegerrequiredMaximum: 9007199254740991
mediaTypestringrequiredValues: image/png · image/jpeg · image/webp · image/svg+xml
executionobjectrequiredساختار داخلی
requestIdstringoptionalMinimum length: 1
Maximum length: 200
modelstringrequiredMinimum length: 1
Maximum length: 200
inputTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
outputTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
totalTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
costUsdnumberoptionalMinimum: 0
Maximum: 10000
researchobjectoptionalساختار داخلی
searchedbooleanrequiredValue: true
sourcesarrayrequiredMaximum items: 8
ساختار داخلی
urlstringrequiredMaximum length: 2048
titlestringrequiredMinimum length: 1
Maximum length: 300
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "ساخت image با موتور استودیو",
"description": "Required scope: studio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "post__v1_studio_image",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ImageRequest"
},
"example": {
"model": "google/gemini-2.5-flash-image",
"prompt": "یک پوستر عمودی از انار سرخ روی میز سنگی، نور نرم پنجره",
"aspectRatio": "auto",
"count": 1
}
}
}
},
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ImageResult"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"studio"
]
}POST/v1/studio/audio
ساخت audio با موتور استودیو
Required scope: studio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
textstringoptionalMinimum length: 1
Maximum length: 12000
presetstringoptionalValues: fast · balanced · quality
Default: "balanced"
modelstringoptionalValues: elevenlabs/eleven-v4 · elevenlabs/eleven-v4-turbo · google/lyria-3-clip-preview · google/lyria-3-pro-preview · mistralai/voxtral-mini-tts-2603 · google/gemini-3.1-flash-tts-preview · google/gemini-3.8-flash-tts · google/gemini-3.8-flash-lite-tts · openai/gpt-audio-mini · openai/gpt-audio
voicestringoptionalMinimum length: 1
Maximum length: 80
formatstringoptionalValues: mp3 · wav · pcm
Default: "mp3"
speednumberoptionalCurrent audio models use natural speed. Gemini pacing is controlled through instructions.
Value: 1
Default: 1
instructionsstringoptionalMaximum length: 2000
turnsarrayoptionalMinimum items: 2
Maximum items: 40
ساختار داخلی
textstringrequiredMinimum length: 1
Maximum length: 12000
voicestringrequiredMinimum length: 1
Maximum length: 80
instructionsstringoptionalMaximum length: 1000
audioInputobjectoptionalساختار داخلی
audioBase64stringrequiredMinimum length: 16
Maximum length: 18666668
mediaTypestringrequiredValues: audio/webm · audio/mp4 · audio/mpeg · audio/wav · audio/ogg · audio/flac · audio/aac
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"model": "google/gemini-3.8-flash-tts",
"text": "سلام! به ساروی خوش آمدید.",
"voice": "Kore",
"format": "wav",
"instructions": "Warm, friendly Persian"
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/studio/audio",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
outputobjectrequiredساختار داخلی
datastringrequiredMinimum length: 16
Maximum length: 40000000
mediaTypestringrequiredValues: audio/mpeg · audio/wav · audio/pcm
executionobjectrequiredساختار داخلی
requestIdstringoptionalMinimum length: 1
Maximum length: 200
modelstringrequiredMinimum length: 1
Maximum length: 200
inputTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
outputTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
totalTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
costUsdnumberoptionalMinimum: 0
Maximum: 10000
researchobjectoptionalساختار داخلی
searchedbooleanrequiredValue: true
sourcesarrayrequiredMaximum items: 8
ساختار داخلی
urlstringrequiredMaximum length: 2048
titlestringrequiredMinimum length: 1
Maximum length: 300
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "ساخت audio با موتور استودیو",
"description": "Required scope: studio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "post__v1_studio_audio",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AudioRequest"
},
"example": {
"model": "google/gemini-3.8-flash-tts",
"text": "سلام! به ساروی خوش آمدید.",
"voice": "Kore",
"format": "wav",
"instructions": "Warm, friendly Persian"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AudioResult"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"studio"
]
}POST/v1/studio/text
ساخت text با موتور استودیو
Required scope: studio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
promptstringrequiredMinimum length: 1
Maximum length: 12000
presetstringoptionalValues: fast · balanced · quality
Default: "balanced"
modelstringoptionalValues: google/gemini-4-argon · meta/muse-wonder · anthropic/claude-haiku-5.5 · mistralai/mistral-large-4-0 · google/gemini-3.1-flash-lite · google/gemini-3.7-flash · google/gemini-3.1-pro-preview · inclusionai/ling-3.1-flash · z-ai/glm-5.3-flash · z-ai/glm-5.3
reasoningEffortstringoptionalmaxOutputTokensintegeroptionalDefault: 2048
Minimum: 128
Maximum: 8192
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"model": "z-ai/glm-5.3",
"prompt": "یک معرفی کوتاه فارسی برای یک فروشگاه بنویس."
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/studio/text",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
textstringrequiredMinimum length: 1
Maximum length: 64000
executionobjectrequiredساختار داخلی
requestIdstringoptionalMinimum length: 1
Maximum length: 200
modelstringrequiredMinimum length: 1
Maximum length: 200
inputTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
outputTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
totalTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
costUsdnumberoptionalMinimum: 0
Maximum: 10000
researchobjectoptionalساختار داخلی
searchedbooleanrequiredValue: true
sourcesarrayrequiredMaximum items: 8
ساختار داخلی
urlstringrequiredMaximum length: 2048
titlestringrequiredMinimum length: 1
Maximum length: 300
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "ساخت text با موتور استودیو",
"description": "Required scope: studio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "post__v1_studio_text",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TextRequest"
},
"example": {
"model": "z-ai/glm-5.3",
"prompt": "یک معرفی کوتاه فارسی برای یک فروشگاه بنویس."
}
}
}
},
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TextResult"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"studio"
]
}POST/v1/studio/video
ساخت video با موتور استودیو
Required scope: studio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
promptstringrequiredMinimum length: 3
Maximum length: 8000
presetstringoptionalValues: fast · balanced · quality
Default: "balanced"
modelstringoptionalValues: google/veo-3.1-lite · google/veo-3.1-fast · kwaivgi/kling-v3.0-std · bytedance/seedance-2.0-mini · bytedance/seedance-2.0-fast · bytedance/seedance-2.0 · bytedance/seedance-2.5 · alibaba/wan-3.0 · runway/gen-4.5 · x-ai/grok-imagine-video-1.5 · x-ai/grok-imagine-video-1.5-lite · openai/sora-2-pro · google/veo-3.1
aspectRatiostringoptionalValues: 1:1 · 16:9 · 9:16 · 4:3 · 3:4 · 3:2 · 2:3 · 21:9
Default: "16:9"
durationintegeroptionalDefault: 6
Minimum: 1
Maximum: 30
resolutionstringoptionalValues: 480p · 720p · 1080p
Default: "720p"
generateAudiobooleanoptionalDefault: false
referenceobjectoptionalساختار داخلی
dataUrlstringrequiredMaximum length: 12000000
referencesarrayoptionalMinimum items: 1
Maximum items: 8
ساختار داخلی
dataUrlstringrequiredMaximum length: 12000000
referenceModestringoptionalValues: guide · frames
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"model": "bytedance/seedance-2.5",
"prompt": "نمای نزدیک گلهای بهاری، حرکت آرام دوربین و نور صبح",
"duration": 4,
"resolution": "480p",
"aspectRatio": "16:9",
"generateAudio": False
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/studio/video",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
202
Accepted; poll status until terminal completion.
providerJobIdstringrequiredMinimum length: 1
Maximum length: 300
statusstringrequiredValues: pending · processing · completed · failed
executionobjectoptionalساختار داخلی
requestIdstringoptionalMinimum length: 1
Maximum length: 200
modelstringrequiredMinimum length: 1
Maximum length: 200
inputTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
outputTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
totalTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
costUsdnumberoptionalMinimum: 0
Maximum: 10000
researchobjectoptionalساختار داخلی
searchedbooleanrequiredValue: true
sourcesarrayrequiredMaximum items: 8
ساختار داخلی
urlstringrequiredMaximum length: 2048
titlestringrequiredMinimum length: 1
Maximum length: 300
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "ساخت video با موتور استودیو",
"description": "Required scope: studio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "post__v1_studio_video",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/VideoRequest"
},
"example": {
"model": "bytedance/seedance-2.5",
"prompt": "نمای نزدیک گلهای بهاری، حرکت آرام دوربین و نور صبح",
"duration": 4,
"resolution": "480p",
"aspectRatio": "16:9",
"generateAudio": false
}
}
}
},
"responses": {
"202": {
"description": "Accepted; poll status until terminal completion.",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/VideoSubmission"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"studio"
]
}POST/v1/studio/video/status
وضعیت و تسویهٔ ساخت ویدیو
Required scope: studio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
idstringrequiredproviderJobIdstringrequiredMinimum length: 1
Maximum length: 300
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"id": "SAROVI_JOB_ID",
"providerJobId": "PROVIDER_JOB_ID"
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/studio/video/status",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
statusstringrequiredValues: pending · processing · completed · failed
contentUrlstringoptionalMaximum length: 4096
errorstringoptionalMaximum length: 400
errorCodestringoptionalMaximum length: 80
retryablebooleanoptionalexecutionobjectoptionalساختار داخلی
requestIdstringoptionalMinimum length: 1
Maximum length: 200
modelstringrequiredMinimum length: 1
Maximum length: 200
inputTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
outputTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
totalTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
costUsdnumberoptionalMinimum: 0
Maximum: 10000
researchobjectoptionalساختار داخلی
searchedbooleanrequiredValue: true
sourcesarrayrequiredMaximum items: 8
ساختار داخلی
urlstringrequiredMaximum length: 2048
titlestringrequiredMinimum length: 1
Maximum length: 300
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "وضعیت و تسویهٔ ساخت ویدیو",
"description": "Required scope: studio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "post__v1_studio_video_status",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/VideoJob"
},
"example": {
"id": "SAROVI_JOB_ID",
"providerJobId": "PROVIDER_JOB_ID"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/VideoStatus"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"studio"
]
}POST/v1/studio/video/content
دریافت فایل ویدیو پس از تکمیل
Required scope: studio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
idstringrequiredproviderJobIdstringrequiredMinimum length: 1
Maximum length: 300
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"id": "SAROVI_JOB_ID",
"providerJobId": "PROVIDER_JOB_ID"
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/studio/video/content",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
with open("sarovi-output", "wb") as output:
output.write(response.read())
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Video file
See the full schema below.
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "دریافت فایل ویدیو پس از تکمیل",
"description": "Required scope: studio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "post__v1_studio_video_content",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/VideoJob"
},
"example": {
"id": "SAROVI_JOB_ID",
"providerJobId": "PROVIDER_JOB_ID"
}
}
}
},
"responses": {
"200": {
"description": "Video file",
"content": {
"video/mp4": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"studio"
]
}POST/v1/audio/transcriptions
تبدیل صدای Base64 به متن
Required scope: audio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
audioBase64stringrequiredMinimum length: 16
Maximum length: 18666668
mediaTypestringrequiredValues: audio/webm · audio/mp4 · audio/mpeg · audio/wav · audio/ogg · audio/flac · audio/aac
modelstringoptionalValues: openai/whisper-large-v3 · openai/whisper-large-v3-turbo
languagestringoptionalپارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"model": "openai/whisper-large-v3-turbo",
"language": "fa",
"audioBase64": "YOUR_BASE64_AUDIO_DATA",
"mediaType": "audio/wav"
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/audio/transcriptions",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
textstringrequiredMinimum length: 1
Maximum length: 32000
executionobjectoptionalساختار داخلی
requestIdstringoptionalMinimum length: 1
Maximum length: 200
modelstringrequiredMinimum length: 1
Maximum length: 200
inputTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
outputTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
totalTokensintegerrequiredMinimum: 0
Maximum: 9007199254740991
costUsdnumberoptionalMinimum: 0
Maximum: 10000
researchobjectoptionalساختار داخلی
searchedbooleanrequiredValue: true
sourcesarrayrequiredMaximum items: 8
ساختار داخلی
urlstringrequiredMaximum length: 2048
titlestringrequiredMinimum length: 1
Maximum length: 300
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "تبدیل صدای Base64 به متن",
"description": "Required scope: audio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "post__v1_audio_transcriptions",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TranscriptionRequest"
},
"example": {
"model": "openai/whisper-large-v3-turbo",
"language": "fa",
"audioBase64": "YOUR_BASE64_AUDIO_DATA",
"mediaType": "audio/wav"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TranscriptionResponse"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"audio"
]
}POST/v1/realtime/calls
ساخت اتصال WebRTC با SDP
Required scope: audio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
sdpstringrequiredMinimum length: 20
Maximum length: 200000
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"sdp": "YOUR_WEBRTC_OFFER_SDP"
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/realtime/calls",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
201
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "ساخت اتصال WebRTC با SDP",
"description": "Required scope: audio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "post__v1_realtime_calls",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RealtimeCreate"
},
"example": {
"sdp": "YOUR_WEBRTC_OFFER_SDP"
}
}
}
},
"responses": {
"201": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"realtime"
]
}DELETE/v1/realtime/calls
پایان اتصال صوتی متعلق به حساب
Required scope: audio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
callIdstringrequiredMinimum length: 4
Maximum length: 160
نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"callId": "YOUR_CALL_ID"
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/realtime/calls",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="DELETE"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "پایان اتصال صوتی متعلق به حساب",
"description": "Required scope: audio:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "delete__v1_realtime_calls",
"security": [
{
"BearerAuth": []
}
],
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RealtimeEnd"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"realtime"
]
}GET/v1/agents
عاملهای پروژه
Required scope: agents:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیرنمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/agents",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "عاملهای پروژه",
"description": "Required scope: agents:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "get__v1_agents",
"security": [
{
"BearerAuth": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"agents"
]
}POST/v1/agents
ذخیرهٔ عامل
Required scope: agents:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
namestringrequiredMinimum length: 1
Maximum length: 80
instructionsstringoptionalMaximum length: 12000
Default: ""
modelstringoptionalValues: google/gemini-4-argon · meta/muse-wonder · inclusionai/ling-3.1-flash · z-ai/glm-5.3-flash · qwen/qwen3.8-flash · anthropic/claude-haiku-5.5 · deepseek/deepseek-v4-flash-0731 · openai/gpt-5.6-luna · openai/gpt-6-luna · google/gemini-3.7-flash · z-ai/glm-5.3 · deepseek/deepseek-v4-pro-0813 · qwen/qwen3.8-max · mistralai/mistral-medium-3-5 · mistralai/mistral-large-4-0 · x-ai/grok-4.6 · openai/gpt-5.6-terra · anthropic/claude-sonnet-5 · openai/gpt-5.6-sol · openai/gpt-6-sol · anthropic/claude-opus-5 · anthropic/claude-opus-5.5 · moonshotai/kimi-k3 · qwen/qwen3.8-2.4t-a95b · anthropic/claude-fable-5 · anthropic/claude-fable-5.1 · openai/gpt-5.5-pro · openai/gpt-6-astra · openai/gpt-6-astra-pro
Default: "z-ai/glm-5.3-flash"
kindstringoptionalValues: chat · research · document · code · data
Default: "chat"
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"name": "دستیار پشتیبانی",
"kind": "chat",
"model": "z-ai/glm-5.3-flash",
"instructions": "به فارسی پاسخ بده. اگر اطلاعات کافی نیست، یک پرسش روشن بپرس."
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/agents",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
201
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "ذخیرهٔ عامل",
"description": "Required scope: agents:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "post__v1_agents",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Agent"
},
"example": {
"name": "دستیار پشتیبانی",
"kind": "chat",
"model": "z-ai/glm-5.3-flash",
"instructions": "به فارسی پاسخ بده. اگر اطلاعات کافی نیست، یک پرسش روشن بپرس."
}
}
}
},
"responses": {
"201": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"agents"
]
}DELETE/v1/agents/{id}
حذف عامل
Required scope: agents:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/agents/{id}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="DELETE"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "حذف عامل",
"description": "Required scope: agents:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "delete__v1_agents_id_",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"agents"
]
}PATCH/v1/agents/{id}
Update the saved agent draft
Required scope: agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیربدنهٔ درخواست
namestringoptionalMinimum length: 1
Maximum length: 80
instructionsstringoptionalMaximum length: 12000
modelstringoptionalMaximum length: 200
پارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/agents/{id}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="PATCH"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
idstringrequiredproject_idstringrequirednamestringrequiredinstructionsstringrequiredmodelstringrequiredkindobjectrequiredValues: chat · research · document · code · data
created_atstringoptionalupdated_atstringoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"agents"
],
"summary": "Update the saved agent draft",
"description": "Required scope: agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "patch__v1_agents_id_",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentPatch"
},
"example": {
"instructions": "Answer from business documents and offer human handoff."
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentRecord"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}POST/v1/agents/{id}/runs
اجرای عامل؛ پاسخ مستقیم یا کار ماندگار
Required scope: agents:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
inputstringrequiredMinimum length: 1
Maximum length: 12000
streambooleanoptionalinclude_reasoningbooleanoptionalreasoning_effortstringoptionalreasoningobjectoptionalساختار داخلی
effortstringrequiredپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"input": "یک پاسخ کوتاه برای مشتری بنویس."
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/agents/{id}/runs",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
202
Durable Work accepted; poll status_url.
See the full schema below.
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "اجرای عامل؛ پاسخ مستقیم یا کار ماندگار",
"description": "Required scope: agents:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "post__v1_agents_id_runs",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentRun"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"202": {
"description": "Durable Work accepted; poll status_url."
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"agents"
]
}POST/v1/work
شروع پژوهش، سند، کد یا تحلیل داده
Required scope: work:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
kindstringrequiredValues: research · document · code · data
inputstringrequiredMinimum length: 10
Maximum length: 12000
titlestringoptionalMinimum length: 1
Maximum length: 100
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"kind": "document",
"title": "راهنمای شروع فروشگاه",
"input": "یک راهنمای عملی فارسی برای شروع فروشگاه کوچک اینترنتی بنویس. چکلیست مراحل و جدول هزینههای نمونه داشته باشد."
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/work",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
202
Work accepted. Poll the existing status_url; do not resubmit to check progress.
idstringrequiredobjectobjectrequiredValue: "run"
statusobjectrequiredValue: "queued"
status_urlstringrequiredfiles_urlstringrequiredreserved_creditsintegerrequiredMinimum: 0
request_idstringoptionaldefault
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "شروع پژوهش، سند، کد یا تحلیل داده",
"description": "Required scope: work:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "post__v1_work",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/WorkRequest"
},
"example": {
"kind": "document",
"title": "راهنمای شروع فروشگاه",
"input": "یک راهنمای عملی فارسی برای شروع فروشگاه کوچک اینترنتی بنویس. چکلیست مراحل و جدول هزینههای نمونه داشته باشد."
}
}
}
},
"responses": {
"202": {
"description": "Work accepted. Poll the existing status_url; do not resubmit to check progress.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/WorkAccepted"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"work"
]
}GET/v1/work/{id}
دریافت وضعیت، رویدادها و فهرست فایلها
Required scope: files:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/work/{id}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "دریافت وضعیت، رویدادها و فهرست فایلها",
"description": "Required scope: files:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "get__v1_work_id_",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"work"
]
}POST/v1/work/{id}/cancel
لغو کار
Required scope: work:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/work/{id}/cancel",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "لغو کار",
"description": "Required scope: work:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "post__v1_work_id_cancel",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"work"
]
}GET/v1/work/{id}/files
دریافت فایل خروجی یا بستهٔ کامل
Required scope: files:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"in": "query",
"name": "path",
"schema": {
"type": "string"
},
"description": "Exact artifact manifest file path; required unless bundle=1."
},
{
"in": "query",
"name": "bundle",
"schema": {
"enum": [
"1"
]
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/work/{id}/files",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
with open("sarovi-output", "wb") as output:
output.write(response.read())
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Artifact file
See the full schema below.
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "دریافت فایل خروجی یا بستهٔ کامل",
"description": "Required scope: files:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "get__v1_work_id_files",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"in": "query",
"name": "path",
"schema": {
"type": "string"
},
"description": "Exact artifact manifest file path; required unless bundle=1."
},
{
"in": "query",
"name": "bundle",
"schema": {
"enum": [
"1"
]
}
}
],
"responses": {
"200": {
"description": "Artifact file",
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"work"
]
}GET/v1/knowledge
پروژههای دانشی مشترک حساب
Required scope: knowledge:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیرنمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/knowledge",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "پروژههای دانشی مشترک حساب",
"description": "Required scope: knowledge:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "get__v1_knowledge",
"security": [
{
"BearerAuth": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"knowledge"
]
}POST/v1/knowledge
ساخت پروژهٔ دانشی در حساب
Required scope: knowledge:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
namestringrequiredMinimum length: 1
Maximum length: 80
instructionsstringoptionalMaximum length: 8000
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"name": "راهنمای محصول",
"instructions": "پاسخها را با توجه به راهنمای محصول بنویس."
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/knowledge",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
201
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "ساخت پروژهٔ دانشی در حساب",
"description": "Required scope: knowledge:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "post__v1_knowledge",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/KnowledgeCreate"
},
"example": {
"name": "راهنمای محصول",
"instructions": "پاسخها را با توجه به راهنمای محصول بنویس."
}
}
}
},
"responses": {
"201": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"knowledge"
]
}GET/v1/files/{id}
دریافت فایل تصویر یا صدای ذخیرهشدهٔ پروژه
Required scope: files:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/files/{id}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
with open("sarovi-output", "wb") as output:
output.write(response.read())
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Stored media file
See the full schema below.
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "دریافت فایل تصویر یا صدای ذخیرهشدهٔ پروژه",
"description": "Required scope: files:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "get__v1_files_id_",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Stored media file",
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"files"
]
}GET/v1/balance
موجودی مشترک حساب
Required scope: usage:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیرنمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/balance",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
The account balance shared by Sarovi products.
balance_creditsintegerrequiredMinimum: 0
planstringrequiredcurrencyobjectrequiredValue: "sarovi_credits"
shared_balanceobjectrequiredValue: true
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "موجودی مشترک حساب",
"description": "Required scope: usage:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "get__v1_balance",
"security": [
{
"BearerAuth": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "The account balance shared by Sarovi products.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Balance"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"balance"
]
}GET/v1/usage
مصرف پروژه در ۳۰ روز گذشته
Required scope: usage:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیرنمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/usage",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "مصرف پروژه در ۳۰ روز گذشته",
"description": "Required scope: usage:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "get__v1_usage",
"security": [
{
"BearerAuth": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"usage"
]
}GET/v1/requests/{id}
گزارش و وضعیت درخواست پروژه
Required scope: usage:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/requests/{id}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "گزارش و وضعیت درخواست پروژه",
"description": "Required scope: usage:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "get__v1_requests_id_",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"requests"
]
}GET/v1/requests/lookup
Recover a request receipt after lost response headers
Required scope: usage:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"in": "query",
"name": "idempotency_key",
"required": true,
"schema": {
"type": "string",
"pattern": "^[A-Za-z0-9._:-]{1,128}$"
},
"description": "The original request key. Only receipts submitted with the current API credential are returned. This does not repeat generation."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/requests/lookup",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Billing metadata only. An empty data array means no receipt was found; it does not prove the original request was uncharged.
dataarrayrequiredMaximum items: 1
ساختار داخلی
idstringrequiredidempotency_keystringrequiredendpointstringrequiredstateobjectrequiredValues: running · completed · failed
status_codeinteger | nulloptionalcreditsintegerrequiredMinimum: 0
pendingbooleanrequireddefault
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "Recover a request receipt after lost response headers",
"description": "Required scope: usage:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "get__v1_requests_lookup",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"in": "query",
"name": "idempotency_key",
"required": true,
"schema": {
"type": "string",
"pattern": "^[A-Za-z0-9._:-]{1,128}$"
},
"description": "The original request key. Only receipts submitted with the current API credential are returned. This does not repeat generation."
}
],
"responses": {
"200": {
"description": "Billing metadata only. An empty data array means no receipt was found; it does not prove the original request was uncharged.",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"type": "array",
"maxItems": 1,
"items": {
"type": "object",
"required": [
"id",
"idempotency_key",
"endpoint",
"state",
"credits",
"pending"
],
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"idempotency_key": {
"type": "string"
},
"endpoint": {
"type": "string"
},
"state": {
"enum": [
"running",
"completed",
"failed"
]
},
"status_code": {
"type": [
"integer",
"null"
]
},
"credits": {
"type": "integer",
"minimum": 0
},
"pending": {
"type": "boolean"
}
}
}
}
}
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"requests"
]
}GET/v1/cloud
فهرست ابرهای پروژه و بستههای آماده
Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیرنمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "فهرست ابرهای پروژه و بستههای آماده",
"description": "Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "get__v1_cloud",
"security": [
{
"BearerAuth": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}POST/v1/cloud
ساخت Starter رایگان یا ابر اختصاصی
Required scope: cloud:write. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
قالب 1
planstringrequiredValue: "starter"
namestringrequiredMinimum length: 2
Maximum length: 80
قالب 2
namestringrequiredMinimum length: 2
Maximum length: 80
regionstringoptionalValues: emea · apac · americas
Default: "emea"
instance_sizestringoptionalValues: micro · small · medium
Default: "micro"
confirm_purchasebooleanrequiredValue: true
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"name": "فروشگاه من",
"plan": "starter"
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
201
Starter created and ready.
See the full schema below.
202
Accepted; poll status until terminal completion.
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "ساخت Starter رایگان یا ابر اختصاصی",
"description": "Required scope: cloud:write. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "post__v1_cloud",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CloudCreate"
},
"example": {
"name": "فروشگاه من",
"plan": "starter"
}
}
}
},
"responses": {
"201": {
"description": "Starter created and ready."
},
"202": {
"description": "Accepted; poll status until terminal completion.",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}DELETE/v1/cloud/{id}
حذف دائمی ابر و سایتهای آن
Required scope: cloud:write. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
confirm_deletebooleanrequiredValue: true
پارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="DELETE"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "حذف دائمی ابر و سایتهای آن",
"description": "Required scope: cloud:write. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "delete__v1_cloud_id_",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CloudDelete"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}GET/v1/cloud/{id}
وضعیت ابر و سلامت سرویسها
Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "وضعیت ابر و سلامت سرویسها",
"description": "Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "get__v1_cloud_id_",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}DELETE/v1/cloud/{id}/sites/{siteId}
حذف دائمی سایت و انتشارهای آن
Required scope: cloud:hosting. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
confirm_deletebooleanrequiredValue: true
پارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "siteId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/sites/{siteId}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="DELETE"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "حذف دائمی سایت و انتشارهای آن",
"description": "Required scope: cloud:hosting. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "delete__v1_cloud_id_sites_siteId_",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "siteId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CloudDelete"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}GET/v1/cloud/{id}/sites/{siteId}
وضعیت و URL انتشار سایت
Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "siteId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/sites/{siteId}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "وضعیت و URL انتشار سایت",
"description": "Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "get__v1_cloud_id_sites_siteId_",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "siteId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}POST/v1/cloud/{id}/retry
ادامهٔ آمادهسازی همان ابر
Required scope: cloud:write. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/retry",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
202
Accepted; poll status until terminal completion.
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "ادامهٔ آمادهسازی همان ابر",
"description": "Required scope: cloud:write. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "post__v1_cloud_id_retry",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"responses": {
"202": {
"description": "Accepted; poll status until terminal completion.",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}GET/v1/cloud/{id}/connection
آدرس سرویس و کلید عمومی برنامه
Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/connection",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "آدرس سرویس و کلید عمومی برنامه",
"description": "Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "get__v1_cloud_id_connection",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}POST/v1/cloud/{id}/database
عملیات مجموعههای Starter یا SQL اختصاصی
Required scope: cloud:write. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
قالب 1
querystringrequiredMinimum length: 1
Maximum length: 40000
read_onlybooleanoptionalDefault: true
confirm_writebooleanoptionalDefault: false
قالب 2
actionstringrequiredValues: create_collection · list · insert · update · delete
tablestringoptionalnamestringoptionalidstringoptionaldataobjectoptionalpublic_readbooleanoptionaloffsetintegeroptionalMinimum: 0
Maximum: 2000
پارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"action": "list",
"table": "records"
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/database",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "عملیات مجموعههای Starter یا SQL اختصاصی",
"description": "Required scope: cloud:write. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "post__v1_cloud_id_database",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CloudSql"
},
"example": {
"action": "list",
"table": "records"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}GET/v1/cloud/{id}/database
فهرست مجموعههای Starter
Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/database",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "فهرست مجموعههای Starter",
"description": "Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "get__v1_cloud_id_database",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}GET/v1/cloud/{id}/auth
تنظیمات ورود کاربران برنامه
Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/auth",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "تنظیمات ورود کاربران برنامه",
"description": "Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "get__v1_cloud_id_auth",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}PATCH/v1/cloud/{id}/auth
آدرس برنامه و دسترسی ثبتنام
Required scope: cloud:write. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
site_urlstringrequireddisable_signupbooleanoptionalDefault: false
پارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"site_url": "https://your-app.example",
"disable_signup": False
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/auth",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="PATCH"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "آدرس برنامه و دسترسی ثبتنام",
"description": "Required scope: cloud:write. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "patch__v1_cloud_id_auth",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CloudAuth"
},
"example": {
"site_url": "https://your-app.example",
"disable_signup": false
}
}
}
},
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}GET/v1/cloud/{id}/storage
فهرست مخزنهای فایل
Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/storage",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "فهرست مخزنهای فایل",
"description": "Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "get__v1_cloud_id_storage",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}POST/v1/cloud/{id}/storage
ساخت مخزن فایل
Required scope: cloud:write. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
namestringrequiredpublicbooleanoptionalDefault: false
file_size_limitintegeroptionalDefault: 10485760
Minimum: 1
Maximum: 52428800
پارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"name": "customer-files",
"public": False,
"file_size_limit": 10485760
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/storage",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
201
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "ساخت مخزن فایل",
"description": "Required scope: cloud:write. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "post__v1_cloud_id_storage",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CloudBucket"
},
"example": {
"name": "customer-files",
"public": false,
"file_size_limit": 10485760
}
}
}
},
"responses": {
"201": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}GET/v1/cloud/{id}/functions
فهرست تابعهای سرور
Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/functions",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "فهرست تابعهای سرور",
"description": "Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "get__v1_cloud_id_functions",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}POST/v1/cloud/{id}/functions
انتشار تابع JavaScript در Starter یا TypeScript اختصاصی
Required scope: cloud:functions. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
namestringrequiredcodestringrequiredMinimum length: 1
Maximum length: 128000
verify_jwtbooleanoptionalDefault: true
پارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"name": "hello-world",
"code": "function handler(input) { return { message: 'Hello from Sarovi Cloud', user: input.user }; }",
"verify_jwt": True
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/functions",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
201
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "انتشار تابع JavaScript در Starter یا TypeScript اختصاصی",
"description": "Required scope: cloud:functions. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "post__v1_cloud_id_functions",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CloudFunction"
},
"example": {
"name": "hello-world",
"code": "function handler(input) { return { message: 'Hello from Sarovi Cloud', user: input.user }; }",
"verify_jwt": true
}
}
}
},
"responses": {
"201": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}POST/v1/cloud/{id}/secrets
ذخیرهٔ متغیر محرمانه؛ مقدار فقط هنگام ارسال
Required scope: cloud:write. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
namestringrequiredvaluestringrequiredMinimum length: 1
Maximum length: 10000
پارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"name": "MY_SERVICE_TOKEN",
"value": "SERVER_SECRET_VALUE"
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/secrets",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "ذخیرهٔ متغیر محرمانه؛ مقدار فقط هنگام ارسال",
"description": "Required scope: cloud:write. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "post__v1_cloud_id_secrets",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CloudSecret"
},
"example": {
"name": "MY_SERVICE_TOKEN",
"value": "SERVER_SECRET_VALUE"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}GET/v1/cloud/{id}/sites
فهرست وبسایتهای ابر
Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/sites",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "فهرست وبسایتهای ابر",
"description": "Required scope: cloud:read. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "get__v1_cloud_id_sites",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}POST/v1/cloud/{id}/sites
انتشار عمومی فایلهای ساختهشدهٔ سایت
Required scope: cloud:hosting. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
namestringrequiredMinimum length: 2
Maximum length: 80
filesarrayrequiredMinimum items: 1
Maximum items: 100
ساختار داخلی
pathstringrequiredMinimum length: 1
Maximum length: 200
contentstringrequiredMaximum length: 2000000
encodingstringoptionalValues: utf8 · base64
Default: "utf8"
confirm_publicbooleanrequiredValue: true
پارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"name": "My site",
"confirm_public": True,
"files": [
{
"path": "index.html",
"content": "<!doctype html><title>My app</title><h1>Hello Sarovi</h1>"
}
]
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/sites",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
202
Accepted; poll status until terminal completion.
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "انتشار عمومی فایلهای ساختهشدهٔ سایت",
"description": "Required scope: cloud:hosting. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "post__v1_cloud_id_sites",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CloudSite"
},
"example": {
"name": "My site",
"confirm_public": true,
"files": [
{
"path": "index.html",
"content": "<!doctype html><title>My app</title><h1>Hello Sarovi</h1>"
}
]
}
}
}
},
"responses": {
"202": {
"description": "Accepted; poll status until terminal completion.",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}POST/v1/cloud/{id}/sites/{siteId}/deployments
انتشار نسخهٔ تازهٔ سایت
Required scope: cloud:hosting. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیربدنهٔ درخواست
filesarrayrequiredMinimum items: 1
Maximum items: 100
ساختار داخلی
pathstringrequiredMinimum length: 1
Maximum length: 200
contentstringrequiredMaximum length: 2000000
encodingstringoptionalValues: utf8 · base64
Default: "utf8"
confirm_publicbooleanrequiredValue: true
پارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "siteId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"confirm_public": True,
"files": [
{
"path": "index.html",
"content": "<!doctype html><title>My app</title><h1>Version two</h1>"
}
]
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/sites/{siteId}/deployments",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
202
Accepted; poll status until terminal completion.
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "انتشار نسخهٔ تازهٔ سایت",
"description": "Required scope: cloud:hosting. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "post__v1_cloud_id_sites_siteId_deployments",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "siteId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CloudRedeploy"
},
"example": {
"confirm_public": true,
"files": [
{
"path": "index.html",
"content": "<!doctype html><title>My app</title><h1>Version two</h1>"
}
]
}
}
}
},
"responses": {
"202": {
"description": "Accepted; poll status until terminal completion.",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}POST/v1/cloud/{id}/functions/{name}/invoke
اجرای مدیریتی تابع Starter
Required scope: cloud:functions. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "name",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/cloud/{id}/functions/{name}/invoke",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "اجرای مدیریتی تابع Starter",
"description": "Required scope: cloud:functions. Starter has capped free infrastructure. Dedicated infrastructure requires an existing paid package and provider availability; AI credits are separate. See /developers/docs for limits and billing.",
"operationId": "post__v1_cloud_id_functions_name_invoke",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "name",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud"
]
}POST/api/cloud-runtime/{cloudId}/auth/signup
Email/password signup; returns a 24-hour opaque app session.
Email/password signup; returns a 24-hour opaque app session. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.
پیوند این مسیربدنهٔ درخواست
object
پارامترها و هدرها
[
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"email": "person@example.com",
"password": "YOUR_APP_PASSWORD"
}
request = urllib.request.Request(
"https://api.sarovi.ir/api/cloud-runtime/{cloudId}/auth/signup",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"apikey": os.environ["SAROVI_CLOUD_APP_KEY"],
"Authorization": "Bearer " + os.environ.get("SAROVI_CLOUD_SESSION_TOKEN", ""),
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_CLOUD_APP_KEY قرار بده. توکن نشست کاربر را در SAROVI_CLOUD_SESSION_TOKEN بگذار. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "Email/password signup; returns a 24-hour opaque app session.",
"description": "Email/password signup; returns a 24-hour opaque app session. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.",
"operationId": "post__api_cloud_runtime_cloudId_auth_signup",
"security": [
{
"AppKey": []
}
],
"parameters": [
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"tags": [
"cloud-runtime"
]
}POST/api/cloud-runtime/{cloudId}/auth/login
Email/password login; returns a 24-hour opaque app session.
Email/password login; returns a 24-hour opaque app session. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.
پیوند این مسیربدنهٔ درخواست
object
پارامترها و هدرها
[
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"email": "person@example.com",
"password": "YOUR_APP_PASSWORD"
}
request = urllib.request.Request(
"https://api.sarovi.ir/api/cloud-runtime/{cloudId}/auth/login",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"apikey": os.environ["SAROVI_CLOUD_APP_KEY"],
"Authorization": "Bearer " + os.environ.get("SAROVI_CLOUD_SESSION_TOKEN", ""),
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_CLOUD_APP_KEY قرار بده. توکن نشست کاربر را در SAROVI_CLOUD_SESSION_TOKEN بگذار. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "Email/password login; returns a 24-hour opaque app session.",
"description": "Email/password login; returns a 24-hour opaque app session. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.",
"operationId": "post__api_cloud_runtime_cloudId_auth_login",
"security": [
{
"AppKey": []
}
],
"parameters": [
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"tags": [
"cloud-runtime"
]
}POST/api/cloud-runtime/{cloudId}/auth/logout
Revoke the current app session.
Revoke the current app session. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.
پیوند این مسیربدنهٔ درخواست
object
پارامترها و هدرها
[
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
}
request = urllib.request.Request(
"https://api.sarovi.ir/api/cloud-runtime/{cloudId}/auth/logout",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"apikey": os.environ["SAROVI_CLOUD_APP_KEY"],
"Authorization": "Bearer " + os.environ.get("SAROVI_CLOUD_SESSION_TOKEN", ""),
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_CLOUD_APP_KEY قرار بده. توکن نشست کاربر را در SAROVI_CLOUD_SESSION_TOKEN بگذار. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "Revoke the current app session.",
"description": "Revoke the current app session. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.",
"operationId": "post__api_cloud_runtime_cloudId_auth_logout",
"security": [
{
"AppKey": []
}
],
"parameters": [
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"tags": [
"cloud-runtime"
]
}GET/api/cloud-runtime/{cloudId}/auth/user
Current authenticated app user.
Current authenticated app user. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/api/cloud-runtime/{cloudId}/auth/user",
headers={
"apikey": os.environ["SAROVI_CLOUD_APP_KEY"],
"Authorization": "Bearer " + os.environ.get("SAROVI_CLOUD_SESSION_TOKEN", ""),
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_CLOUD_APP_KEY قرار بده. توکن نشست کاربر را در SAROVI_CLOUD_SESSION_TOKEN بگذار. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "Current authenticated app user.",
"description": "Current authenticated app user. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.",
"operationId": "get__api_cloud_runtime_cloudId_auth_user",
"security": [
{
"AppKey": []
}
],
"parameters": [
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud-runtime"
]
}GET/api/cloud-runtime/{cloudId}/data/{table}
Owner-scoped JSON rows, or public_read rows. offset pagination, maximum 100 rows.
Owner-scoped JSON rows, or public_read rows. offset pagination, maximum 100 rows. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "table",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/api/cloud-runtime/{cloudId}/data/{table}",
headers={
"apikey": os.environ["SAROVI_CLOUD_APP_KEY"],
"Authorization": "Bearer " + os.environ.get("SAROVI_CLOUD_SESSION_TOKEN", ""),
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_CLOUD_APP_KEY قرار بده. توکن نشست کاربر را در SAROVI_CLOUD_SESSION_TOKEN بگذار. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "Owner-scoped JSON rows, or public_read rows. offset pagination, maximum 100 rows.",
"description": "Owner-scoped JSON rows, or public_read rows. offset pagination, maximum 100 rows. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.",
"operationId": "get__api_cloud_runtime_cloudId_data_table_",
"security": [
{
"AppKey": []
}
],
"parameters": [
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "table",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud-runtime"
]
}POST/api/cloud-runtime/{cloudId}/data/{table}
Insert a JSON row owned by the signed-in app user.
Insert a JSON row owned by the signed-in app user. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.
پیوند این مسیربدنهٔ درخواست
object
پارامترها و هدرها
[
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "table",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"title": "Hello Sarovi"
}
request = urllib.request.Request(
"https://api.sarovi.ir/api/cloud-runtime/{cloudId}/data/{table}",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"apikey": os.environ["SAROVI_CLOUD_APP_KEY"],
"Authorization": "Bearer " + os.environ.get("SAROVI_CLOUD_SESSION_TOKEN", ""),
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_CLOUD_APP_KEY قرار بده. توکن نشست کاربر را در SAROVI_CLOUD_SESSION_TOKEN بگذار. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "Insert a JSON row owned by the signed-in app user.",
"description": "Insert a JSON row owned by the signed-in app user. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.",
"operationId": "post__api_cloud_runtime_cloudId_data_table_",
"security": [
{
"AppKey": []
}
],
"parameters": [
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "table",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"tags": [
"cloud-runtime"
]
}PATCH/api/cloud-runtime/{cloudId}/data/{table}/{rowId}
Replace the JSON data of an owned row.
Replace the JSON data of an owned row. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.
پیوند این مسیربدنهٔ درخواست
object
پارامترها و هدرها
[
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "table",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "rowId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"title": "Hello Sarovi"
}
request = urllib.request.Request(
"https://api.sarovi.ir/api/cloud-runtime/{cloudId}/data/{table}/{rowId}",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"apikey": os.environ["SAROVI_CLOUD_APP_KEY"],
"Authorization": "Bearer " + os.environ.get("SAROVI_CLOUD_SESSION_TOKEN", ""),
"Content-Type": "application/json"
},
method="PATCH"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_CLOUD_APP_KEY قرار بده. توکن نشست کاربر را در SAROVI_CLOUD_SESSION_TOKEN بگذار. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "Replace the JSON data of an owned row.",
"description": "Replace the JSON data of an owned row. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.",
"operationId": "patch__api_cloud_runtime_cloudId_data_table_rowId_",
"security": [
{
"AppKey": []
}
],
"parameters": [
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "table",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "rowId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"tags": [
"cloud-runtime"
]
}DELETE/api/cloud-runtime/{cloudId}/data/{table}/{rowId}
Delete an owned row.
Delete an owned row. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "table",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "rowId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/api/cloud-runtime/{cloudId}/data/{table}/{rowId}",
headers={
"apikey": os.environ["SAROVI_CLOUD_APP_KEY"],
"Authorization": "Bearer " + os.environ.get("SAROVI_CLOUD_SESSION_TOKEN", ""),
"Content-Type": "application/json"
},
method="DELETE"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_CLOUD_APP_KEY قرار بده. توکن نشست کاربر را در SAROVI_CLOUD_SESSION_TOKEN بگذار. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "Delete an owned row.",
"description": "Delete an owned row. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.",
"operationId": "delete__api_cloud_runtime_cloudId_data_table_rowId_",
"security": [
{
"AppKey": []
}
],
"parameters": [
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "table",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "rowId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud-runtime"
]
}GET/api/cloud-runtime/{cloudId}/files
List files owned by the signed-in app user.
List files owned by the signed-in app user. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/api/cloud-runtime/{cloudId}/files",
headers={
"apikey": os.environ["SAROVI_CLOUD_APP_KEY"],
"Authorization": "Bearer " + os.environ.get("SAROVI_CLOUD_SESSION_TOKEN", ""),
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_CLOUD_APP_KEY قرار بده. توکن نشست کاربر را در SAROVI_CLOUD_SESSION_TOKEN بگذار. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "List files owned by the signed-in app user.",
"description": "List files owned by the signed-in app user. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.",
"operationId": "get__api_cloud_runtime_cloudId_files",
"security": [
{
"AppKey": []
}
],
"parameters": [
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud-runtime"
]
}POST/api/cloud-runtime/{cloudId}/files
Upload name and content_base64; maximum decoded size 1 MiB.
Upload name and content_base64; maximum decoded size 1 MiB. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.
پیوند این مسیربدنهٔ درخواست
object
پارامترها و هدرها
[
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"name": "hello.txt",
"content_base64": "SGVsbG8="
}
request = urllib.request.Request(
"https://api.sarovi.ir/api/cloud-runtime/{cloudId}/files",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"apikey": os.environ["SAROVI_CLOUD_APP_KEY"],
"Authorization": "Bearer " + os.environ.get("SAROVI_CLOUD_SESSION_TOKEN", ""),
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_CLOUD_APP_KEY قرار بده. توکن نشست کاربر را در SAROVI_CLOUD_SESSION_TOKEN بگذار. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "Upload name and content_base64; maximum decoded size 1 MiB.",
"description": "Upload name and content_base64; maximum decoded size 1 MiB. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.",
"operationId": "post__api_cloud_runtime_cloudId_files",
"security": [
{
"AppKey": []
}
],
"parameters": [
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"tags": [
"cloud-runtime"
]
}GET/api/cloud-runtime/{cloudId}/files/{fileId}
Download an owned file as attachment bytes.
Download an owned file as attachment bytes. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "fileId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/api/cloud-runtime/{cloudId}/files/{fileId}",
headers={
"apikey": os.environ["SAROVI_CLOUD_APP_KEY"],
"Authorization": "Bearer " + os.environ.get("SAROVI_CLOUD_SESSION_TOKEN", ""),
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
with open("sarovi-output", "wb") as output:
output.write(response.read())
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_CLOUD_APP_KEY قرار بده. توکن نشست کاربر را در SAROVI_CLOUD_SESSION_TOKEN بگذار. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Private attachment bytes
See the full schema below.
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "Download an owned file as attachment bytes.",
"description": "Download an owned file as attachment bytes. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.",
"operationId": "get__api_cloud_runtime_cloudId_files_fileId_",
"security": [
{
"AppKey": []
}
],
"parameters": [
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "fileId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
],
"responses": {
"200": {
"description": "Private attachment bytes",
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud-runtime"
]
}DELETE/api/cloud-runtime/{cloudId}/files/{fileId}
Delete an owned file.
Delete an owned file. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "fileId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/api/cloud-runtime/{cloudId}/files/{fileId}",
headers={
"apikey": os.environ["SAROVI_CLOUD_APP_KEY"],
"Authorization": "Bearer " + os.environ.get("SAROVI_CLOUD_SESSION_TOKEN", ""),
"Content-Type": "application/json"
},
method="DELETE"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_CLOUD_APP_KEY قرار بده. توکن نشست کاربر را در SAROVI_CLOUD_SESSION_TOKEN بگذار. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "Delete an owned file.",
"description": "Delete an owned file. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.",
"operationId": "delete__api_cloud_runtime_cloudId_files_fileId_",
"security": [
{
"AppKey": []
}
],
"parameters": [
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "fileId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"tags": [
"cloud-runtime"
]
}POST/api/cloud-runtime/{cloudId}/functions/{name}
Invoke a synchronous Starter function. A session is required when verify_jwt is enabled.
Invoke a synchronous Starter function. A session is required when verify_jwt is enabled. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.
پیوند این مسیربدنهٔ درخواست
object
پارامترها و هدرها
[
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "name",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
}
request = urllib.request.Request(
"https://api.sarovi.ir/api/cloud-runtime/{cloudId}/functions/{name}",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"apikey": os.environ["SAROVI_CLOUD_APP_KEY"],
"Authorization": "Bearer " + os.environ.get("SAROVI_CLOUD_SESSION_TOKEN", ""),
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_CLOUD_APP_KEY قرار بده. توکن نشست کاربر را در SAROVI_CLOUD_SESSION_TOKEN بگذار. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"summary": "Invoke a synchronous Starter function. A session is required when verify_jwt is enabled.",
"description": "Invoke a synchronous Starter function. A session is required when verify_jwt is enabled. Send apikey: scpub_... and Authorization: Bearer sct_... for signed-in operations. See /developers/docs/cloud-auth. Capped free Starter operations; no AI credit charge.",
"operationId": "post__api_cloud_runtime_cloudId_functions_name_",
"security": [
{
"AppKey": []
}
],
"parameters": [
{
"name": "cloudId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "name",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"schema": {
"type": "string"
},
"description": "Bearer sct_... app session; optional for signup/login and public operations."
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Structured error. 400 invalid input; 401 invalid key; 402 balance or budget; 403 scope/plan/account; 404 resource; 409 idempotency conflict; 429 rate/concurrency; 5xx service/provider.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"tags": [
"cloud-runtime"
]
}GET/v1/agent-templates
Ready-to-use support, sales and receptionist templates
Required scope: agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرنمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/agent-templates",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
dataarrayrequiredساختار داخلی
idobjectrequiredValues: support · sales · receptionist
namestringrequireddescriptionstringrequiredinstructionsstringrequiredcollect_leadsbooleanoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"agent-templates"
],
"summary": "Ready-to-use support, sales and receptionist templates",
"description": "Required scope: agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "get__v1_agent_templates",
"security": [
{
"BearerAuth": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentTemplates"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}GET/v1/batches
List this project’s recent batches
Required scope: usage:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرنمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/batches",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
dataarrayrequiredساختار داخلی
idstringrequiredproject_idstringoptionalkey_idstring | nulloptionalnamestringrequiredstatusobjectrequiredValues: queued · running · completed · cancelled
totalintegerrequiredMinimum: 0
succeededintegerrequiredMinimum: 0
failedintegerrequiredMinimum: 0
cancelledintegerrequiredMinimum: 0
cancel_requestedbooleanoptionalmax_creditsintegerrequiredMinimum: 0
creditsintegerrequiredMinimum: 0
customer_idstring | nulloptionalcreated_atstringoptionalcompleted_atstring | nulloptionalexpires_atstringoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"batches"
],
"summary": "List this project’s recent batches",
"description": "Required scope: usage:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "get__v1_batches",
"security": [
{
"BearerAuth": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BatchList"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}POST/v1/batches
Queue a durable text batch at standard model pricing
Required scope: responses:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیربدنهٔ درخواست
namestringoptionalMinimum length: 1
Maximum length: 100
Default: "پردازش گروهی"
requestsarrayrequiredMinimum items: 1
Maximum items: 1000
ساختار داخلی
custom_idstringrequiredMinimum length: 1
Maximum length: 120
bodyobjectrequiredساختار داخلی
modelstringoptionalMinimum length: 1
Maximum length: 200
Default: "z-ai/glm-5.3-flash"
inputstringrequiredMinimum length: 1
Maximum length: 32000
instructionsstringoptionalMaximum length: 8000
max_output_tokensintegeroptionalDefault: 512
Minimum: 128
Maximum: 2048
max_creditsintegerrequiredMinimum: 1
Maximum: 10000000
customer_idstringoptionalMinimum length: 1
Maximum length: 120
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/batches",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
202
Durably accepted. Poll until all rows reach a final state.
idstringrequiredproject_idstringoptionalkey_idstring | nulloptionalnamestringrequiredstatusobjectrequiredValues: queued · running · completed · cancelled
totalintegerrequiredMinimum: 0
succeededintegerrequiredMinimum: 0
failedintegerrequiredMinimum: 0
cancelledintegerrequiredMinimum: 0
cancel_requestedbooleanoptionalmax_creditsintegerrequiredMinimum: 0
creditsintegerrequiredMinimum: 0
customer_idstring | nulloptionalcreated_atstringoptionalcompleted_atstring | nulloptionalexpires_atstringoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"batches"
],
"summary": "Queue a durable text batch at standard model pricing",
"description": "Required scope: responses:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "post__v1_batches",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BatchCreate"
},
"example": {
"name": "Product descriptions",
"max_credits": 300,
"requests": [
{
"custom_id": "product-1",
"body": {
"model": "z-ai/glm-5.3-flash",
"input": "Write a short Persian description of a handmade ceramic cup.",
"max_output_tokens": 512
}
}
]
}
}
}
},
"responses": {
"202": {
"description": "Durably accepted. Poll until all rows reach a final state.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Batch"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}POST/v1/batches/estimate
Estimate the maximum batch credit reservation
Required scope: responses:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیربدنهٔ درخواست
namestringoptionalMinimum length: 1
Maximum length: 100
Default: "پردازش گروهی"
requestsarrayrequiredMinimum items: 1
Maximum items: 1000
ساختار داخلی
custom_idstringrequiredMinimum length: 1
Maximum length: 120
bodyobjectrequiredساختار داخلی
modelstringoptionalMinimum length: 1
Maximum length: 200
Default: "z-ai/glm-5.3-flash"
inputstringrequiredMinimum length: 1
Maximum length: 32000
instructionsstringoptionalMaximum length: 8000
max_output_tokensintegeroptionalDefault: 512
Minimum: 128
Maximum: 2048
max_creditsintegerrequiredMinimum: 1
Maximum: 10000000
customer_idstringoptionalMinimum length: 1
Maximum length: 120
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/batches/estimate",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
rowsarrayrequiredساختار داخلی
custom_idstringrequiredmax_creditsintegerrequiredMinimum: 0
total_max_creditsintegerrequiredMinimum: 0
currencyobjectrequiredValue: "sarovi_credits"
pricingobjectrequiredValue: "standard"
discount_percentobjectoptionalValue: 0
default
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"batches"
],
"summary": "Estimate the maximum batch credit reservation",
"description": "Required scope: responses:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "post__v1_batches_estimate",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BatchCreate"
},
"example": {
"name": "Product descriptions",
"max_credits": 300,
"requests": [
{
"custom_id": "product-1",
"body": {
"model": "z-ai/glm-5.3-flash",
"input": "Write a short Persian description of a handmade ceramic cup.",
"max_output_tokens": 512
}
}
]
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BatchEstimate"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}GET/v1/batches/{id}
Read batch progress and charged or pending credits
Required scope: usage:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/batches/{id}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
idstringrequiredproject_idstringoptionalkey_idstring | nulloptionalnamestringrequiredstatusobjectrequiredValues: queued · running · completed · cancelled
totalintegerrequiredMinimum: 0
succeededintegerrequiredMinimum: 0
failedintegerrequiredMinimum: 0
cancelledintegerrequiredMinimum: 0
cancel_requestedbooleanoptionalmax_creditsintegerrequiredMinimum: 0
creditsintegerrequiredMinimum: 0
customer_idstring | nulloptionalcreated_atstringoptionalcompleted_atstring | nulloptionalexpires_atstringoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"batches"
],
"summary": "Read batch progress and charged or pending credits",
"description": "Required scope: usage:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "get__v1_batches_id_",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Batch"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}POST/v1/batches/{id}/cancel
Cancel rows that have not started
Required scope: responses:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/batches/{id}/cancel",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
idstringrequiredproject_idstringoptionalkey_idstring | nulloptionalnamestringrequiredstatusobjectrequiredValues: queued · running · completed · cancelled
totalintegerrequiredMinimum: 0
succeededintegerrequiredMinimum: 0
failedintegerrequiredMinimum: 0
cancelledintegerrequiredMinimum: 0
cancel_requestedbooleanoptionalmax_creditsintegerrequiredMinimum: 0
creditsintegerrequiredMinimum: 0
customer_idstring | nulloptionalcreated_atstringoptionalcompleted_atstring | nulloptionalexpires_atstringoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"batches"
],
"summary": "Cancel rows that have not started",
"description": "Required scope: responses:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "post__v1_batches_id_cancel",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Batch"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}POST/v1/batches/{id}/retry
Create a new batch from failed rows only
Required scope: responses:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیربدنهٔ درخواست
max_creditsintegerrequiredMinimum: 1
Maximum: 10000000
include_uncertainbooleanoptionalDefault: false
پارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/batches/{id}/retry",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
202
Durably accepted. Poll until all rows reach a final state.
idstringrequiredproject_idstringoptionalkey_idstring | nulloptionalnamestringrequiredstatusobjectrequiredValues: queued · running · completed · cancelled
totalintegerrequiredMinimum: 0
succeededintegerrequiredMinimum: 0
failedintegerrequiredMinimum: 0
cancelledintegerrequiredMinimum: 0
cancel_requestedbooleanoptionalmax_creditsintegerrequiredMinimum: 0
creditsintegerrequiredMinimum: 0
customer_idstring | nulloptionalcreated_atstringoptionalcompleted_atstring | nulloptionalexpires_atstringoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"batches"
],
"summary": "Create a new batch from failed rows only",
"description": "Required scope: responses:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "post__v1_batches_id_retry",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BatchRetry"
},
"example": {
"max_credits": 300,
"include_uncertain": false
}
}
}
},
"responses": {
"202": {
"description": "Durably accepted. Poll until all rows reach a final state.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Batch"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}GET/v1/batches/{id}/results
Download per-row results, preserving custom_id
Required scope: usage:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "format",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "json, jsonl, or csv"
},
{
"name": "status",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "Optional row status filter"
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/batches/{id}/results",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
dataarrayrequiredساختار داخلی
idstringoptionalcustom_idstringrequiredstatusobjectrequiredValues: queued · running · succeeded · failed · cancelled
request_idstringrequiredresultobject | nulloptionalساختار داخلی
idstringoptionaloutput_textstringoptionalstatusstringoptionalusageobjectoptionalerrorobject | nulloptionalساختار داخلی
codestringoptionalmessagestringoptionalrequest_idstringoptionalbodyobject | nulloptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"batches"
],
"summary": "Download per-row results, preserving custom_id",
"description": "Required scope: usage:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "get__v1_batches_id_results",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "format",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "json, jsonl, or csv"
},
{
"name": "status",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "Optional row status filter"
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BatchResults"
}
},
"text/csv": {
"schema": {
"type": "string"
}
},
"application/x-ndjson": {
"schema": {
"type": "string"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}GET/v1/agents/{id}/configuration
Read draft and published agent configuration
Required scope: agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/agents/{id}/configuration",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
agent_idstringoptionaldraftobjectoptionalساختار داخلی
enabledbooleanoptionalDefault: true
max_input_charsintegeroptionalDefault: 12000
Minimum: 100
Maximum: 12000
max_stepsintegeroptionalDefault: 4
Minimum: 1
Maximum: 4
require_knowledgebooleanoptionalDefault: false
templatestringoptionalValues: support · sales · receptionist · custom
Default: "support"
knowledge_idsarrayoptionalMaximum items: 5
Default: []
ساختار داخلی
string
greetingstringoptionalMaximum length: 500
Default: "سلام! چطور میتوانم کمکتان کنم؟"
max_creditsintegeroptionalDefault: 300
Minimum: 1
Maximum: 100000
max_output_tokensintegeroptionalDefault: 512
Minimum: 128
Maximum: 2048
collect_leadsbooleanoptionalDefault: false
allow_handoffbooleanoptionalDefault: true
retention_daysnumber | numberoptionalDefault: 7
ساختار داخلی
قالب 1
number
قالب 2
number
published_versioninteger | nulloptionalpublishedobject | nulloptionalساختار داخلی
agentobjectoptionalconfigobjectoptionalساختار داخلی
enabledbooleanoptionalDefault: true
max_input_charsintegeroptionalDefault: 12000
Minimum: 100
Maximum: 12000
max_stepsintegeroptionalDefault: 4
Minimum: 1
Maximum: 4
require_knowledgebooleanoptionalDefault: false
templatestringoptionalValues: support · sales · receptionist · custom
Default: "support"
knowledge_idsarrayoptionalMaximum items: 5
Default: []
ساختار داخلی
string
greetingstringoptionalMaximum length: 500
Default: "سلام! چطور میتوانم کمکتان کنم؟"
max_creditsintegeroptionalDefault: 300
Minimum: 1
Maximum: 100000
max_output_tokensintegeroptionalDefault: 512
Minimum: 128
Maximum: 2048
collect_leadsbooleanoptionalDefault: false
allow_handoffbooleanoptionalDefault: true
retention_daysnumber | numberoptionalDefault: 7
ساختار داخلی
قالب 1
number
قالب 2
number
default
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"agents"
],
"summary": "Read draft and published agent configuration",
"description": "Required scope: agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "get__v1_agents_id_configuration",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentConfigurationResult"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}PATCH/v1/agents/{id}/configuration
Save a business agent draft configuration
Required scope: agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیربدنهٔ درخواست
enabledbooleanoptionalDefault: true
max_input_charsintegeroptionalDefault: 12000
Minimum: 100
Maximum: 12000
max_stepsintegeroptionalDefault: 4
Minimum: 1
Maximum: 4
require_knowledgebooleanoptionalDefault: false
templatestringoptionalValues: support · sales · receptionist · custom
Default: "support"
knowledge_idsarrayoptionalMaximum items: 5
Default: []
ساختار داخلی
string
greetingstringoptionalMaximum length: 500
Default: "سلام! چطور میتوانم کمکتان کنم؟"
max_creditsintegeroptionalDefault: 300
Minimum: 1
Maximum: 100000
max_output_tokensintegeroptionalDefault: 512
Minimum: 128
Maximum: 2048
collect_leadsbooleanoptionalDefault: false
allow_handoffbooleanoptionalDefault: true
retention_daysnumber | numberoptionalDefault: 7
ساختار داخلی
قالب 1
number
قالب 2
number
پارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/agents/{id}/configuration",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="PATCH"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
agent_idstringoptionaldraftobjectoptionalساختار داخلی
enabledbooleanoptionalDefault: true
max_input_charsintegeroptionalDefault: 12000
Minimum: 100
Maximum: 12000
max_stepsintegeroptionalDefault: 4
Minimum: 1
Maximum: 4
require_knowledgebooleanoptionalDefault: false
templatestringoptionalValues: support · sales · receptionist · custom
Default: "support"
knowledge_idsarrayoptionalMaximum items: 5
Default: []
ساختار داخلی
string
greetingstringoptionalMaximum length: 500
Default: "سلام! چطور میتوانم کمکتان کنم؟"
max_creditsintegeroptionalDefault: 300
Minimum: 1
Maximum: 100000
max_output_tokensintegeroptionalDefault: 512
Minimum: 128
Maximum: 2048
collect_leadsbooleanoptionalDefault: false
allow_handoffbooleanoptionalDefault: true
retention_daysnumber | numberoptionalDefault: 7
ساختار داخلی
قالب 1
number
قالب 2
number
published_versioninteger | nulloptionalpublishedobject | nulloptionalساختار داخلی
agentobjectoptionalconfigobjectoptionalساختار داخلی
enabledbooleanoptionalDefault: true
max_input_charsintegeroptionalDefault: 12000
Minimum: 100
Maximum: 12000
max_stepsintegeroptionalDefault: 4
Minimum: 1
Maximum: 4
require_knowledgebooleanoptionalDefault: false
templatestringoptionalValues: support · sales · receptionist · custom
Default: "support"
knowledge_idsarrayoptionalMaximum items: 5
Default: []
ساختار داخلی
string
greetingstringoptionalMaximum length: 500
Default: "سلام! چطور میتوانم کمکتان کنم؟"
max_creditsintegeroptionalDefault: 300
Minimum: 1
Maximum: 100000
max_output_tokensintegeroptionalDefault: 512
Minimum: 128
Maximum: 2048
collect_leadsbooleanoptionalDefault: false
allow_handoffbooleanoptionalDefault: true
retention_daysnumber | numberoptionalDefault: 7
ساختار داخلی
قالب 1
number
قالب 2
number
default
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"agents"
],
"summary": "Save a business agent draft configuration",
"description": "Required scope: agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "patch__v1_agents_id_configuration",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentConfiguration"
},
"example": {
"template": "support",
"knowledge_ids": [],
"max_credits": 300,
"allow_handoff": true
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentConfigurationResult"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}POST/v1/agents/{id}/publish
Publish an immutable configuration or restore an earlier version
Required scope: agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیربدنهٔ درخواست
restore_versionintegeroptionalMinimum: 1
Maximum: 9007199254740991
پارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/agents/{id}/publish",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
agent_idstringoptionaldraftobjectoptionalساختار داخلی
enabledbooleanoptionalDefault: true
max_input_charsintegeroptionalDefault: 12000
Minimum: 100
Maximum: 12000
max_stepsintegeroptionalDefault: 4
Minimum: 1
Maximum: 4
require_knowledgebooleanoptionalDefault: false
templatestringoptionalValues: support · sales · receptionist · custom
Default: "support"
knowledge_idsarrayoptionalMaximum items: 5
Default: []
ساختار داخلی
string
greetingstringoptionalMaximum length: 500
Default: "سلام! چطور میتوانم کمکتان کنم؟"
max_creditsintegeroptionalDefault: 300
Minimum: 1
Maximum: 100000
max_output_tokensintegeroptionalDefault: 512
Minimum: 128
Maximum: 2048
collect_leadsbooleanoptionalDefault: false
allow_handoffbooleanoptionalDefault: true
retention_daysnumber | numberoptionalDefault: 7
ساختار داخلی
قالب 1
number
قالب 2
number
published_versioninteger | nulloptionalpublishedobject | nulloptionalساختار داخلی
agentobjectoptionalconfigobjectoptionalساختار داخلی
enabledbooleanoptionalDefault: true
max_input_charsintegeroptionalDefault: 12000
Minimum: 100
Maximum: 12000
max_stepsintegeroptionalDefault: 4
Minimum: 1
Maximum: 4
require_knowledgebooleanoptionalDefault: false
templatestringoptionalValues: support · sales · receptionist · custom
Default: "support"
knowledge_idsarrayoptionalMaximum items: 5
Default: []
ساختار داخلی
string
greetingstringoptionalMaximum length: 500
Default: "سلام! چطور میتوانم کمکتان کنم؟"
max_creditsintegeroptionalDefault: 300
Minimum: 1
Maximum: 100000
max_output_tokensintegeroptionalDefault: 512
Minimum: 128
Maximum: 2048
collect_leadsbooleanoptionalDefault: false
allow_handoffbooleanoptionalDefault: true
retention_daysnumber | numberoptionalDefault: 7
ساختار داخلی
قالب 1
number
قالب 2
number
default
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"agents"
],
"summary": "Publish an immutable configuration or restore an earlier version",
"description": "Required scope: agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "post__v1_agents_id_publish",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentPublish"
},
"example": {}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentConfigurationResult"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}GET/v1/agents/{id}/versions
List immutable published agent versions
Required scope: agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/agents/{id}/versions",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
dataarrayrequiredساختار داخلی
agent_idstringoptionalversionintegeroptionalMinimum: 0
snapshotobjectoptionalساختار داخلی
agentobjectoptionalconfigobjectoptionalساختار داخلی
enabledbooleanoptionalDefault: true
max_input_charsintegeroptionalDefault: 12000
Minimum: 100
Maximum: 12000
max_stepsintegeroptionalDefault: 4
Minimum: 1
Maximum: 4
require_knowledgebooleanoptionalDefault: false
templatestringoptionalValues: support · sales · receptionist · custom
Default: "support"
knowledge_idsarrayoptionalMaximum items: 5
Default: []
ساختار داخلی
string
greetingstringoptionalMaximum length: 500
Default: "سلام! چطور میتوانم کمکتان کنم؟"
max_creditsintegeroptionalDefault: 300
Minimum: 1
Maximum: 100000
max_output_tokensintegeroptionalDefault: 512
Minimum: 128
Maximum: 2048
collect_leadsbooleanoptionalDefault: false
allow_handoffbooleanoptionalDefault: true
retention_daysnumber | numberoptionalDefault: 7
ساختار داخلی
قالب 1
number
قالب 2
number
created_atstringoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"agents"
],
"summary": "List immutable published agent versions",
"description": "Required scope: agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "get__v1_agents_id_versions",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentVersions"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}POST/v1/agents/{id}/chat
Run a published business agent in a customer-scoped conversation
Required scope: agents:run, or agents:write plus responses:write (legacy). draft:true requires agents:write plus responses:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیربدنهٔ درخواست
inputstringrequiredMinimum length: 1
Maximum length: 12000
customer_idstringrequiredMinimum length: 1
Maximum length: 120
conversation_idstringoptionaldraftbooleanoptionalDefault: false
پارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/agents/{id}/chat",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
idstringrequiredconversation_idstringrequiredagent_idstringrequiredcustomer_idstringrequiredversioninteger | nulloptionalstatusobjectrequiredValue: "completed"
output_textstringrequiredsourcesarrayrequiredساختار داخلی
idstringoptionalnamestringoptionalindexintegeroptionalMinimum: 0
outcomesarrayrequiredساختار داخلی
idstringrequiredtypeobjectrequiredValues: agent.lead · agent.handoff
statusobjectrequiredValue: "requested"
namestringoptionalcontactstringoptionalneedstringoptionalreasonstringoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"agents"
],
"summary": "Run a published business agent in a customer-scoped conversation",
"description": "Required scope: agents:run, or agents:write plus responses:write (legacy). draft:true requires agents:write plus responses:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "post__v1_agents_id_chat",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ManagedAgentInput"
},
"example": {
"input": "What services do you offer?",
"customer_id": "customer-123"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ManagedAgentResult"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}GET/v1/agents/{id}/history
Inspect recent runs and business outcomes
Required scope: agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/agents/{id}/history",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
dataarrayrequiredساختار داخلی
idstringoptionalconversation_idstringoptionalversioninteger | nulloptionalstatusstringoptionalresultobject | nulloptionalساختار داخلی
output_textstringoptionaloutcomesarrayoptionalساختار داخلی
idstringrequiredtypeobjectrequiredValues: agent.lead · agent.handoff
statusobjectrequiredValue: "requested"
namestringoptionalcontactstringoptionalneedstringoptionalreasonstringoptionalerrorobjectoptionalساختار داخلی
codestringoptionalcreated_atstringoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"agents"
],
"summary": "Inspect recent runs and business outcomes",
"description": "Required scope: agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "get__v1_agents_id_history",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AgentHistory"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}GET/v1/conversations/{id}
Read the specified customer conversation
Required scope: agents:run or agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "customer_id",
"in": "query",
"required": true,
"schema": {
"type": "string"
},
"description": "Server-controlled customer identifier"
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/conversations/{id}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
idstringrequiredproject_idstringoptionalagent_idstringrequiredcustomer_idstringrequiredmessagesarrayrequiredساختار داخلی
roleobjectoptionalValues: user · assistant
contentstringoptionalcreated_atstringoptionalupdated_atstringoptionalexpires_atstringoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"conversations"
],
"summary": "Read the specified customer conversation",
"description": "Required scope: agents:run or agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "get__v1_conversations_id_",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "customer_id",
"in": "query",
"required": true,
"schema": {
"type": "string"
},
"description": "Server-controlled customer identifier"
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Conversation"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}DELETE/v1/conversations/{id}
Delete the specified customer conversation
Required scope: agents:run or agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "customer_id",
"in": "query",
"required": true,
"schema": {
"type": "string"
},
"description": "Server-controlled customer identifier"
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/conversations/{id}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="DELETE"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
default
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"conversations"
],
"summary": "Delete the specified customer conversation",
"description": "Required scope: agents:run or agents:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "delete__v1_conversations_id_",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "customer_id",
"in": "query",
"required": true,
"schema": {
"type": "string"
},
"description": "Server-controlled customer identifier"
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Empty"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}GET/v1/knowledge-bases
List knowledge bases owned by this API project
Required scope: knowledge:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرنمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/knowledge-bases",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
dataarrayrequiredساختار داخلی
idstringrequirednamestringrequiredinstructionsstringoptionaldocument_countintegeroptionalMinimum: 0
total_bytesintegeroptionalMinimum: 0
created_atstringoptionalupdated_atstringoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"knowledge-bases"
],
"summary": "List knowledge bases owned by this API project",
"description": "Required scope: knowledge:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "get__v1_knowledge_bases",
"security": [
{
"BearerAuth": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/KnowledgeBaseList"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}POST/v1/knowledge-bases
Create project-scoped business knowledge
Required scope: knowledge:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیربدنهٔ درخواست
namestringrequiredMinimum length: 1
Maximum length: 80
instructionsstringoptionalMaximum length: 8000
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/knowledge-bases",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
201
Success
idstringrequirednamestringrequiredinstructionsstringoptionaldocument_countintegeroptionalMinimum: 0
total_bytesintegeroptionalMinimum: 0
created_atstringoptionalupdated_atstringoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"knowledge-bases"
],
"summary": "Create project-scoped business knowledge",
"description": "Required scope: knowledge:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "post__v1_knowledge_bases",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/KnowledgeBaseCreate"
},
"example": {
"name": "Product handbook"
}
}
}
},
"responses": {
"201": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/KnowledgeBase"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}GET/v1/knowledge-bases/{id}
Inspect documents and indexing results
Required scope: knowledge:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/knowledge-bases/{id}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
projectobjectrequiredساختار داخلی
idstringrequirednamestringrequiredinstructionsstringoptionaldocument_countintegeroptionalMinimum: 0
total_bytesintegeroptionalMinimum: 0
created_atstringoptionalupdated_atstringoptionaldocumentsarrayrequiredساختار داخلی
idstringrequiredproject_idstringrequirednamestringrequiredmedia_typestringoptionalsize_bytesintegeroptionalMinimum: 0
sha256stringoptionalcreated_atstringoptionalupdated_atstringoptionalconversationsarrayoptionalساختار داخلی
object
memoriesarrayoptionalساختار داخلی
object
sharedbooleanoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"knowledge-bases"
],
"summary": "Inspect documents and indexing results",
"description": "Required scope: knowledge:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "get__v1_knowledge_bases_id_",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/KnowledgeSnapshot"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}DELETE/v1/knowledge-bases/{id}
Delete a project knowledge base
Required scope: knowledge:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/knowledge-bases/{id}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="DELETE"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
deletedbooleanoptionalidstringoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"knowledge-bases"
],
"summary": "Delete a project knowledge base",
"description": "Required scope: knowledge:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "delete__v1_knowledge_bases_id_",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Deleted"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}POST/v1/knowledge-bases/{id}/documents
Import text, a public HTTPS page, or a base64 document up to 2 MB
Required scope: knowledge:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیربدنهٔ درخواست
namestringrequiredMinimum length: 1
Maximum length: 180
textstringoptionalMaximum length: 1500000
urlstringoptionalcontent_base64stringoptionalMaximum length: 2800000
media_typestringoptionalپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/knowledge-bases/{id}/documents",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
201
Success
documentobjectrequiredساختار داخلی
idstringrequiredproject_idstringrequirednamestringrequiredmedia_typestringoptionalsize_bytesintegeroptionalMinimum: 0
sha256stringoptionalcreated_atstringoptionalupdated_atstringoptionalstatusobjectrequiredValue: "ready"
default
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"knowledge-bases"
],
"summary": "Import text, a public HTTPS page, or a base64 document up to 2 MB",
"description": "Required scope: knowledge:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "post__v1_knowledge_bases_id_documents",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/KnowledgeDocumentCreate"
},
"example": {
"name": "Opening hours",
"text": "We answer customer questions Sunday–Thursday, 09:00–17:00."
}
}
}
},
"responses": {
"201": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/KnowledgeDocumentResult"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}DELETE/v1/knowledge-bases/{id}/documents/{documentId}
Delete a source document
Required scope: knowledge:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "documentId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/knowledge-bases/{id}/documents/{documentId}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="DELETE"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
deletedbooleanoptionalidstringoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"knowledge-bases"
],
"summary": "Delete a source document",
"description": "Required scope: knowledge:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "delete__v1_knowledge_bases_id_documents_documentId_",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "documentId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Deleted"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}GET/v1/webhooks
List webhook endpoints without signing secrets
Required scope: webhooks:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرنمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/webhooks",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
dataarrayrequiredساختار داخلی
idstringrequiredproject_idstringoptionalurlstringrequiredeventsarrayrequiredساختار داخلی
string
enabledbooleanrequiredcreated_atstringoptionalsecretstringoptionalReturned only once on creation. Store on your server.
default
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"webhooks"
],
"summary": "List webhook endpoints without signing secrets",
"description": "Required scope: webhooks:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "get__v1_webhooks",
"security": [
{
"BearerAuth": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/WebhookList"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}POST/v1/webhooks
Create a signed HTTPS event delivery endpoint
Required scope: webhooks:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیربدنهٔ درخواست
urlstringrequiredMaximum length: 2048
eventsarrayrequiredMinimum items: 1
Maximum items: 5
ساختار داخلی
string
enabledbooleanoptionalDefault: true
پارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/webhooks",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
201
Success
idstringrequiredproject_idstringoptionalurlstringrequiredeventsarrayrequiredساختار داخلی
string
enabledbooleanrequiredcreated_atstringoptionalsecretstringoptionalReturned only once on creation. Store on your server.
default
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"webhooks"
],
"summary": "Create a signed HTTPS event delivery endpoint",
"description": "Required scope: webhooks:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "post__v1_webhooks",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string"
},
"description": "Reuse this value when retrying the identical request."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/WebhookCreate"
},
"example": {
"url": "https://your-app.example/events",
"events": [
"batch.completed",
"agent.lead",
"agent.handoff"
],
"enabled": true
}
}
}
},
"responses": {
"201": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Webhook"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}DELETE/v1/webhooks/{id}
Remove a webhook and stop pending delivery
Required scope: webhooks:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/webhooks/{id}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="DELETE"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
default
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"webhooks"
],
"summary": "Remove a webhook and stop pending delivery",
"description": "Required scope: webhooks:write. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "delete__v1_webhooks_id_",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Empty"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}GET/v1/webhooks/deliveries
Inspect delivery attempts and response status
Required scope: webhooks:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرنمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/webhooks/deliveries",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
dataarrayrequiredساختار داخلی
idstringoptionalevent_idstringoptionalwebhook_idstringoptionalstateobjectoptionalValues: queued · sending · delivered · failed
attemptsintegeroptionalMinimum: 0
last_statusinteger | nulloptionalnext_atstringoptionalcreated_atstringoptionaldefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"webhooks"
],
"summary": "Inspect delivery attempts and response status",
"description": "Required scope: webhooks:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "get__v1_webhooks_deliveries",
"security": [
{
"BearerAuth": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/WebhookDeliveries"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}GET/v1/usage/budget
Read the current monthly project budget and alert threshold
Required scope: usage:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرنمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/usage/budget",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
monthly_limitintegerrequiredMinimum: 0
used_creditsintegerrequiredMinimum: 0
remaining_creditsintegerrequiredMinimum: 0
threshold_reachedbooleanrequiredresets_atstringrequireddefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"usage"
],
"summary": "Read the current monthly project budget and alert threshold",
"description": "Required scope: usage:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "get__v1_usage_budget",
"security": [
{
"BearerAuth": []
}
],
"parameters": [],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BusinessBudget"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}GET/v1/usage/export
Export customer-labelled usage with stable cursor pagination
Required scope: usage:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "from",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "ISO timestamp; default 30 days ago"
},
{
"name": "through",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "ISO timestamp; keep fixed while paginating"
},
{
"name": "cursor",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "next_cursor from previous page"
},
{
"name": "customer_id",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": ""
},
{
"name": "format",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "json or csv"
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/usage/export",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
dataarrayrequiredساختار داخلی
idstringrequiredcreated_atstringrequiredendpointstringrequiredmodelstring | nulloptionalkey_idstring | nulloptionalcustomer_idstring | nulloptionalreference_idstring | nulloptionalagent_idstring | nulloptionalbatch_idstring | nulloptionalstatestringrequiredstatus_codeinteger | nulloptionalerror_codestring | nulloptionalcreditsintegerrequiredMinimum: 0
pendingbooleanrequiredinput_tokensintegeroptionalMinimum: 0
output_tokensintegeroptionalMinimum: 0
duration_msinteger | nulloptionalnext_cursorstring | nullrequiredfromstringrequiredthroughstringrequireddefault
Structured API error; no successful completion is implied.
errorobjectrequiredساختار داخلی
codestringrequiredmessagestringrequiredparamstringoptionalSafe path of an invalid request field, when known.
execution_startedbooleanoptionalPresent for validation rejected before execution.
Value: false
request_idstringrequiredقرارداد کامل OpenAPI
{
"tags": [
"usage"
],
"summary": "Export customer-labelled usage with stable cursor pagination",
"description": "Required scope: usage:read. See /developers/docs/business-start. Shared account credits; business budgets and project ownership are enforced.",
"operationId": "get__v1_usage_export",
"security": [
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "from",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "ISO timestamp; default 30 days ago"
},
{
"name": "through",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "ISO timestamp; keep fixed while paginating"
},
{
"name": "cursor",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "next_cursor from previous page"
},
{
"name": "customer_id",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": ""
},
{
"name": "format",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "json or csv"
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UsageExport"
}
},
"text/csv": {
"schema": {
"type": "string"
}
}
}
},
"default": {
"description": "Structured API error; no successful completion is implied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}POST/v1/messages
Anthropic Messages: thinking, caching, media and native tools
Required scope: responses:write. Native Messages preserves thinking signatures, cache controls and counters, PDFs/citations, client tools including computer use, and bounded hosted tools. Capability depends on the selected model. Computer tools execute in your application. Full request limit: 4 MB. See the compatibility guide for supported tool versions and beta headers.
پیوند این مسیربدنهٔ درخواست
modelstringrequiredMinimum length: 1
Maximum length: 200
max_tokensintegerrequiredMinimum: 1
Maximum: 32768
messagesarrayrequiredMinimum items: 1
Maximum items: 1000
ساختار داخلی
rolestringrequiredValues: user · assistant
contentstring | arrayrequiredساختار داخلی
قالب 1
string
قالب 2
Array
systemstring | arrayoptionalساختار داخلی
قالب 1
string
قالب 2
Array
streambooleanoptionalDefault: false
temperaturenumberoptionalMinimum: 0
Maximum: 1
top_pnumberoptionalMinimum: 0
Maximum: 1
top_kintegeroptionalMinimum: 0
Maximum: 9007199254740991
toolsarrayoptionalMaximum items: 128
ساختار داخلی
قالب 1
typestringoptionalValue: "custom"
namestringrequireddescriptionstringoptionalMaximum length: 16000
input_schemaobjectrequiredstrictbooleanoptionalcache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 2
typestringrequiredValues: web_search_20250305 · web_search_20260209
namestringrequiredValue: "web_search"
max_usesintegeroptionalDefault: 1
Minimum: 1
Maximum: 5
allowed_domainsarray | nulloptionalساختار داخلی
قالب 1
Array
قالب 2
null
blocked_domainsarray | nulloptionalساختار داخلی
قالب 1
Array
قالب 2
null
user_locationobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "approximate"
citystringoptionalMaximum length: 200
regionstringoptionalMaximum length: 200
countrystringoptionalMinimum length: 2
Maximum length: 2
timezonestringoptionalMaximum length: 100
قالب 2
null
cache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 3
typestringrequiredValue: "web_fetch_20250910"
namestringrequiredValue: "web_fetch"
max_usesintegeroptionalDefault: 1
Minimum: 1
Maximum: 5
max_content_tokensintegeroptionalDefault: 8000
Minimum: 1
Maximum: 32000
allowed_domainsarray | nulloptionalساختار داخلی
قالب 1
Array
قالب 2
null
blocked_domainsarray | nulloptionalساختار داخلی
قالب 1
Array
قالب 2
null
citationsobjectoptionalساختار داخلی
enabledbooleanrequiredcache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 4
typestringrequiredValues: computer_20250124 · computer_20251124
namestringrequiredValue: "computer"
display_width_pxintegerrequiredMinimum: 1
Maximum: 8192
display_height_pxintegerrequiredMinimum: 1
Maximum: 8192
display_numberintegeroptionalMinimum: 0
Maximum: 100
enable_zoombooleanoptionalcache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 5
قالب 1
typestringrequiredValue: "bash_20250124"
namestringrequiredValue: "bash"
cache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 2
typestringrequiredValues: text_editor_20250124 · text_editor_20250728
namestringrequiredValues: str_replace_editor · str_replace_based_edit_tool
cache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 6
typestringrequiredValues: openrouter:web_search · openrouter:web_fetch · openrouter:datetime · openrouter:bash
tool_choiceobject | object | objectoptionalساختار داخلی
قالب 1
typestringrequiredValues: auto · any
disable_parallel_tool_usebooleanoptionalقالب 2
typestringrequiredValue: "tool"
namestringrequiredMaximum length: 100
disable_parallel_tool_usebooleanoptionalقالب 3
typestringrequiredValue: "none"
thinkingobject | object | objectoptionalساختار داخلی
قالب 1
typestringrequiredValue: "enabled"
budget_tokensintegerrequiredMinimum: 1024
Maximum: 32767
displaystringoptionalValues: summarized · omitted
قالب 2
typestringrequiredValue: "adaptive"
displaystringoptionalValues: summarized · omitted
قالب 3
typestringrequiredValue: "disabled"
cache_controlobjectoptionalساختار داخلی
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
stop_sequencesarrayoptionalMaximum items: 20
ساختار داخلی
string
metadataobjectoptionalساختار داخلی
user_idstring | nulloptionalساختار داخلی
قالب 1
string
قالب 2
null
output_configobjectoptionalساختار داخلی
effortstringoptionalValues: low · medium · high · max
formatobjectoptionalساختار داخلی
typestringrequiredValue: "json_schema"
schemaobjectrequiredپارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
},
{
"name": "anthropic-version",
"in": "header",
"required": true,
"schema": {
"const": "2023-06-01"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
"model": "anthropic/claude-opus-5.5",
"max_tokens": 512,
"messages": [
{
"role": "user",
"content": "سلام!"
}
]
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/messages",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"anthropic-version": "2023-06-01",
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Message JSON or named SSE events ending in message_stop. Mid-stream failures emit error; EOF is not success.
idstringrequiredtypeobjectrequiredValue: "message"
roleobjectrequiredValue: "assistant"
modelstringrequiredcontentarrayrequiredساختار داخلی
قالب 1
typeobjectrequiredValue: "text"
textstringrequiredقالب 2
typeobjectrequiredValues: tool_use · server_tool_use
idstringrequirednamestringrequiredinputobjectrequiredقالب 3
typeobjectrequiredValues: thinking · redacted_thinking · web_search_tool_result · web_fetch_tool_result · bash_tool_result · shell_tool_result · openrouter_bash_tool_result · openrouter_shell_tool_result
thinkingstringoptionalsignaturestringoptionaldatastringoptionalstop_reasonobjectrequiredValues: end_turn · max_tokens · tool_use · stop_sequence · pause_turn · refusal · model_context_window_exceeded
stop_sequencestring | nullrequiredusageobjectrequiredساختار داخلی
input_tokensintegerrequiredMinimum: 0
output_tokensintegerrequiredMinimum: 0
total_tokensintegeroptionalMinimum: 0
cache_creation_input_tokensintegeroptionalMinimum: 0
cache_read_input_tokensintegeroptionalMinimum: 0
server_tool_useobject | nulloptionaldefault
Anthropic-shaped error with the Sarovi request ID.
typeobjectrequiredValue: "error"
request_idstringoptionalerrorobjectrequiredساختار داخلی
typestringrequiredmessagestringrequiredقرارداد کامل OpenAPI
{
"summary": "Anthropic Messages: thinking, caching, media and native tools",
"description": "Required scope: responses:write. Native Messages preserves thinking signatures, cache controls and counters, PDFs/citations, client tools including computer use, and bounded hosted tools. Capability depends on the selected model. Computer tools execute in your application. Full request limit: 4 MB. See the compatibility guide for supported tool versions and beta headers.",
"operationId": "post__v1_messages",
"security": [
{
"AnthropicKey": []
},
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
},
{
"name": "anthropic-version",
"in": "header",
"required": true,
"schema": {
"const": "2023-06-01"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AnthropicRequest"
}
}
}
},
"responses": {
"200": {
"description": "Message JSON or named SSE events ending in message_stop. Mid-stream failures emit error; EOF is not success.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AnthropicMessage"
}
},
"text/event-stream": {
"schema": {
"type": "string"
}
}
}
},
"default": {
"description": "Anthropic-shaped error with the Sarovi request ID.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AnthropicError"
}
}
}
}
},
"tags": [
"messages"
]
}POST/v1/messages/count_tokens
Exact token count (not configured in this release)
Returns HTTP 503 until a direct Anthropic counting connection is configured. Never generates output or charges credits. No local estimate is substituted.
پیوند این مسیربدنهٔ درخواست
modelstringrequiredMinimum length: 1
Maximum length: 200
messagesarrayrequiredMinimum items: 1
Maximum items: 1000
ساختار داخلی
rolestringrequiredValues: user · assistant
contentstring | arrayrequiredساختار داخلی
قالب 1
string
قالب 2
Array
systemstring | arrayoptionalساختار داخلی
قالب 1
string
قالب 2
Array
toolsarrayoptionalMaximum items: 128
ساختار داخلی
قالب 1
typestringoptionalValue: "custom"
namestringrequireddescriptionstringoptionalMaximum length: 16000
input_schemaobjectrequiredstrictbooleanoptionalcache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 2
typestringrequiredValues: web_search_20250305 · web_search_20260209
namestringrequiredValue: "web_search"
max_usesintegeroptionalDefault: 1
Minimum: 1
Maximum: 5
allowed_domainsarray | nulloptionalساختار داخلی
قالب 1
Array
قالب 2
null
blocked_domainsarray | nulloptionalساختار داخلی
قالب 1
Array
قالب 2
null
user_locationobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "approximate"
citystringoptionalMaximum length: 200
regionstringoptionalMaximum length: 200
countrystringoptionalMinimum length: 2
Maximum length: 2
timezonestringoptionalMaximum length: 100
قالب 2
null
cache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 3
typestringrequiredValue: "web_fetch_20250910"
namestringrequiredValue: "web_fetch"
max_usesintegeroptionalDefault: 1
Minimum: 1
Maximum: 5
max_content_tokensintegeroptionalDefault: 8000
Minimum: 1
Maximum: 32000
allowed_domainsarray | nulloptionalساختار داخلی
قالب 1
Array
قالب 2
null
blocked_domainsarray | nulloptionalساختار داخلی
قالب 1
Array
قالب 2
null
citationsobjectoptionalساختار داخلی
enabledbooleanrequiredcache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 4
typestringrequiredValues: computer_20250124 · computer_20251124
namestringrequiredValue: "computer"
display_width_pxintegerrequiredMinimum: 1
Maximum: 8192
display_height_pxintegerrequiredMinimum: 1
Maximum: 8192
display_numberintegeroptionalMinimum: 0
Maximum: 100
enable_zoombooleanoptionalcache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 5
قالب 1
typestringrequiredValue: "bash_20250124"
namestringrequiredValue: "bash"
cache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 2
typestringrequiredValues: text_editor_20250124 · text_editor_20250728
namestringrequiredValues: str_replace_editor · str_replace_based_edit_tool
cache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 6
typestringrequiredValues: openrouter:web_search · openrouter:web_fetch · openrouter:datetime · openrouter:bash
tool_choiceobject | object | objectoptionalساختار داخلی
قالب 1
typestringrequiredValues: auto · any
disable_parallel_tool_usebooleanoptionalقالب 2
typestringrequiredValue: "tool"
namestringrequiredMaximum length: 100
disable_parallel_tool_usebooleanoptionalقالب 3
typestringrequiredValue: "none"
thinkingobject | object | objectoptionalساختار داخلی
قالب 1
typestringrequiredValue: "enabled"
budget_tokensintegerrequiredMinimum: 1024
Maximum: 32767
displaystringoptionalValues: summarized · omitted
قالب 2
typestringrequiredValue: "adaptive"
displaystringoptionalValues: summarized · omitted
قالب 3
typestringrequiredValue: "disabled"
output_configobjectoptionalساختار داخلی
effortstringoptionalValues: low · medium · high · max
formatobjectoptionalساختار داخلی
typestringrequiredValue: "json_schema"
schemaobjectrequiredپارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
},
{
"name": "anthropic-version",
"in": "header",
"required": true,
"schema": {
"const": "2023-06-01"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/messages/count_tokens",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Anthropic-shaped error with the Sarovi request ID.
typeobjectrequiredValue: "error"
request_idstringoptionalerrorobjectrequiredساختار داخلی
typestringrequiredmessagestringrequiredقرارداد کامل OpenAPI
{
"summary": "Exact token count (not configured in this release)",
"description": "Returns HTTP 503 until a direct Anthropic counting connection is configured. Never generates output or charges credits. No local estimate is substituted.",
"operationId": "post__v1_messages_count_tokens",
"security": [
{
"AnthropicKey": []
},
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
},
{
"name": "anthropic-version",
"in": "header",
"required": true,
"schema": {
"const": "2023-06-01"
}
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Anthropic-shaped error with the Sarovi request ID.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AnthropicError"
}
}
}
}
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"model": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"messages": {
"minItems": 1,
"maxItems": 1000,
"type": "array",
"items": {
"type": "object",
"properties": {
"role": {
"type": "string",
"enum": [
"user",
"assistant"
]
},
"content": {
"anyOf": [
{
"type": "string",
"maxLength": 2000000
},
{
"minItems": 1,
"maxItems": 100,
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "text"
},
"text": {
"type": "string",
"maxLength": 2000000
},
"citations": {
"anyOf": [
{
"maxItems": 100,
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
}
},
{
"type": "null"
}
]
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"text"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "image"
},
"source": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "url"
},
"url": {
"type": "string",
"maxLength": 8000,
"format": "uri"
}
},
"required": [
"type",
"url"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "base64"
},
"media_type": {
"type": "string",
"enum": [
"image/jpeg",
"image/png",
"image/gif",
"image/webp"
]
},
"data": {
"type": "string",
"minLength": 4,
"maxLength": 2800000
}
},
"required": [
"type",
"media_type",
"data"
],
"additionalProperties": false
}
]
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"source"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "document"
},
"source": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "base64"
},
"media_type": {
"type": "string",
"const": "application/pdf"
},
"data": {
"type": "string",
"minLength": 4,
"maxLength": 2800000
}
},
"required": [
"type",
"media_type",
"data"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "url"
},
"url": {
"type": "string",
"maxLength": 8000,
"format": "uri"
}
},
"required": [
"type",
"url"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "text"
},
"media_type": {
"type": "string",
"const": "text/plain"
},
"data": {
"type": "string",
"maxLength": 2000000
}
},
"required": [
"type",
"media_type",
"data"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "content"
},
"content": {
"anyOf": [
{
"type": "string",
"maxLength": 2000000
},
{
"maxItems": 100,
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "text"
},
"text": {
"type": "string",
"maxLength": 2000000
},
"citations": {
"anyOf": [
{
"maxItems": 100,
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
}
},
{
"type": "null"
}
]
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"text"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "image"
},
"source": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "url"
},
"url": {
"type": "string",
"maxLength": 8000,
"format": "uri"
}
},
"required": [
"type",
"url"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "base64"
},
"media_type": {
"type": "string",
"enum": [
"image/jpeg",
"image/png",
"image/gif",
"image/webp"
]
},
"data": {
"type": "string",
"minLength": 4,
"maxLength": 2800000
}
},
"required": [
"type",
"media_type",
"data"
],
"additionalProperties": false
}
]
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"source"
],
"additionalProperties": false
}
]
}
}
]
}
},
"required": [
"type",
"content"
],
"additionalProperties": false
}
]
},
"title": {
"anyOf": [
{
"type": "string",
"maxLength": 500
},
{
"type": "null"
}
]
},
"context": {
"anyOf": [
{
"type": "string",
"maxLength": 16000
},
{
"type": "null"
}
]
},
"citations": {
"anyOf": [
{
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
}
},
"required": [
"enabled"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"source"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"tool_use",
"server_tool_use"
]
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"input": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"caller": {
"anyOf": [
{
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
{
"type": "null"
}
]
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"id",
"name",
"input"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "tool_result"
},
"tool_use_id": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"content": {
"anyOf": [
{
"type": "string",
"maxLength": 2000000
},
{
"maxItems": 100,
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "text"
},
"text": {
"type": "string",
"maxLength": 2000000
},
"citations": {
"anyOf": [
{
"maxItems": 100,
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
}
},
{
"type": "null"
}
]
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"text"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "image"
},
"source": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "url"
},
"url": {
"type": "string",
"maxLength": 8000,
"format": "uri"
}
},
"required": [
"type",
"url"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "base64"
},
"media_type": {
"type": "string",
"enum": [
"image/jpeg",
"image/png",
"image/gif",
"image/webp"
]
},
"data": {
"type": "string",
"minLength": 4,
"maxLength": 2800000
}
},
"required": [
"type",
"media_type",
"data"
],
"additionalProperties": false
}
]
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"source"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "document"
},
"source": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "base64"
},
"media_type": {
"type": "string",
"const": "application/pdf"
},
"data": {
"type": "string",
"minLength": 4,
"maxLength": 2800000
}
},
"required": [
"type",
"media_type",
"data"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "url"
},
"url": {
"type": "string",
"maxLength": 8000,
"format": "uri"
}
},
"required": [
"type",
"url"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "text"
},
"media_type": {
"type": "string",
"const": "text/plain"
},
"data": {
"type": "string",
"maxLength": 2000000
}
},
"required": [
"type",
"media_type",
"data"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "content"
},
"content": {
"anyOf": [
{
"type": "string",
"maxLength": 2000000
},
{
"maxItems": 100,
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "text"
},
"text": {
"type": "string",
"maxLength": 2000000
},
"citations": {
"anyOf": [
{
"maxItems": 100,
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
}
},
{
"type": "null"
}
]
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"text"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "image"
},
"source": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "url"
},
"url": {
"type": "string",
"maxLength": 8000,
"format": "uri"
}
},
"required": [
"type",
"url"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "base64"
},
"media_type": {
"type": "string",
"enum": [
"image/jpeg",
"image/png",
"image/gif",
"image/webp"
]
},
"data": {
"type": "string",
"minLength": 4,
"maxLength": 2800000
}
},
"required": [
"type",
"media_type",
"data"
],
"additionalProperties": false
}
]
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"source"
],
"additionalProperties": false
}
]
}
}
]
}
},
"required": [
"type",
"content"
],
"additionalProperties": false
}
]
},
"title": {
"anyOf": [
{
"type": "string",
"maxLength": 500
},
{
"type": "null"
}
]
},
"context": {
"anyOf": [
{
"type": "string",
"maxLength": 16000
},
{
"type": "null"
}
]
},
"citations": {
"anyOf": [
{
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
}
},
"required": [
"enabled"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"source"
],
"additionalProperties": false
}
]
}
}
]
},
"is_error": {
"type": "boolean"
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"tool_use_id"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"web_search_tool_result",
"web_fetch_tool_result",
"code_execution_tool_result",
"bash_code_execution_tool_result",
"text_editor_code_execution_tool_result",
"bash_tool_result",
"shell_tool_result",
"openrouter_bash_tool_result",
"openrouter_shell_tool_result"
]
},
"tool_use_id": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"content": {},
"caller": {
"anyOf": [
{
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
{
"type": "null"
}
]
},
"container_id": {
"type": "string",
"maxLength": 200
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"tool_use_id",
"content"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "thinking"
},
"thinking": {
"type": "string",
"maxLength": 2000000
},
"signature": {
"type": "string",
"maxLength": 100000
}
},
"required": [
"type",
"thinking",
"signature"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "redacted_thinking"
},
"data": {
"type": "string",
"maxLength": 2000000
}
},
"required": [
"type",
"data"
],
"additionalProperties": false
}
]
}
}
]
}
},
"required": [
"role",
"content"
],
"additionalProperties": false
}
},
"system": {
"anyOf": [
{
"type": "string",
"maxLength": 2000000
},
{
"maxItems": 100,
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "text"
},
"text": {
"type": "string",
"maxLength": 2000000
},
"citations": {
"anyOf": [
{
"maxItems": 100,
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
}
},
{
"type": "null"
}
]
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"text"
],
"additionalProperties": false
}
}
]
},
"tools": {
"maxItems": 128,
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "custom"
},
"name": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]{1,64}$"
},
"description": {
"type": "string",
"maxLength": 16000
},
"input_schema": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"strict": {
"type": "boolean"
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"name",
"input_schema"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"web_search_20250305",
"web_search_20260209"
]
},
"name": {
"type": "string",
"const": "web_search"
},
"max_uses": {
"default": 1,
"type": "integer",
"minimum": 1,
"maximum": 5
},
"allowed_domains": {
"anyOf": [
{
"maxItems": 100,
"type": "array",
"items": {
"type": "string",
"maxLength": 253
}
},
{
"type": "null"
}
]
},
"blocked_domains": {
"anyOf": [
{
"maxItems": 100,
"type": "array",
"items": {
"type": "string",
"maxLength": 253
}
},
{
"type": "null"
}
]
},
"user_location": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "approximate"
},
"city": {
"type": "string",
"maxLength": 200
},
"region": {
"type": "string",
"maxLength": 200
},
"country": {
"type": "string",
"minLength": 2,
"maxLength": 2
},
"timezone": {
"type": "string",
"maxLength": 100
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"name"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "web_fetch_20250910"
},
"name": {
"type": "string",
"const": "web_fetch"
},
"max_uses": {
"default": 1,
"type": "integer",
"minimum": 1,
"maximum": 5
},
"max_content_tokens": {
"default": 8000,
"type": "integer",
"minimum": 1,
"maximum": 32000
},
"allowed_domains": {
"anyOf": [
{
"maxItems": 100,
"type": "array",
"items": {
"type": "string",
"maxLength": 253
}
},
{
"type": "null"
}
]
},
"blocked_domains": {
"anyOf": [
{
"maxItems": 100,
"type": "array",
"items": {
"type": "string",
"maxLength": 253
}
},
{
"type": "null"
}
]
},
"citations": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
}
},
"required": [
"enabled"
],
"additionalProperties": false
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"name"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"computer_20250124",
"computer_20251124"
]
},
"name": {
"type": "string",
"const": "computer"
},
"display_width_px": {
"type": "integer",
"minimum": 1,
"maximum": 8192
},
"display_height_px": {
"type": "integer",
"minimum": 1,
"maximum": 8192
},
"display_number": {
"type": "integer",
"minimum": 0,
"maximum": 100
},
"enable_zoom": {
"type": "boolean"
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"name",
"display_width_px",
"display_height_px"
],
"additionalProperties": false
},
{
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "bash_20250124"
},
"name": {
"type": "string",
"const": "bash"
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"name"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"text_editor_20250124",
"text_editor_20250728"
]
},
"name": {
"type": "string",
"enum": [
"str_replace_editor",
"str_replace_based_edit_tool"
]
},
"cache_control": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "ephemeral"
},
"ttl": {
"type": "string",
"enum": [
"5m",
"1h"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"type",
"name"
],
"additionalProperties": false
}
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"openrouter:web_search",
"openrouter:web_fetch",
"openrouter:datetime",
"openrouter:bash"
]
}
},
"required": [
"type"
],
"additionalProperties": false
}
]
}
},
"tool_choice": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"auto",
"any"
]
},
"disable_parallel_tool_use": {
"type": "boolean"
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "tool"
},
"name": {
"type": "string",
"maxLength": 100
},
"disable_parallel_tool_use": {
"type": "boolean"
}
},
"required": [
"type",
"name"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "none"
}
},
"required": [
"type"
],
"additionalProperties": false
}
]
},
"thinking": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "enabled"
},
"budget_tokens": {
"type": "integer",
"minimum": 1024,
"maximum": 32767
},
"display": {
"type": "string",
"enum": [
"summarized",
"omitted"
]
}
},
"required": [
"type",
"budget_tokens"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "adaptive"
},
"display": {
"type": "string",
"enum": [
"summarized",
"omitted"
]
}
},
"required": [
"type"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "disabled"
}
},
"required": [
"type"
],
"additionalProperties": false
}
]
},
"output_config": {
"type": "object",
"properties": {
"effort": {
"type": "string",
"enum": [
"low",
"medium",
"high",
"max"
]
},
"format": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "json_schema"
},
"schema": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
}
},
"required": [
"type",
"schema"
],
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"required": [
"model",
"messages"
],
"additionalProperties": false
}
}
}
},
"tags": [
"messages"
]
}POST/v1/messages/batches
Create durable Messages batch
Up to 1,000 unique custom_id requests, 4 MB total. Each params object must use stream:false or omit stream. Uses the Sarovi durable queue at normal usage prices; no provider batch discount. Results are retained for 7 days.
پیوند این مسیربدنهٔ درخواست
requestsarrayrequiredMinimum items: 1
Maximum items: 1000
ساختار داخلی
custom_idstringrequiredparamsobjectrequiredساختار داخلی
modelstringrequiredMinimum length: 1
Maximum length: 200
max_tokensintegerrequiredMinimum: 1
Maximum: 32768
messagesarrayrequiredMinimum items: 1
Maximum items: 1000
ساختار داخلی
rolestringrequiredValues: user · assistant
contentstring | arrayrequiredساختار داخلی
قالب 1
string
قالب 2
Array
systemstring | arrayoptionalساختار داخلی
قالب 1
string
قالب 2
Array
streambooleanoptionalDefault: false
temperaturenumberoptionalMinimum: 0
Maximum: 1
top_pnumberoptionalMinimum: 0
Maximum: 1
top_kintegeroptionalMinimum: 0
Maximum: 9007199254740991
toolsarrayoptionalMaximum items: 128
ساختار داخلی
قالب 1
typestringoptionalValue: "custom"
namestringrequireddescriptionstringoptionalMaximum length: 16000
input_schemaobjectrequiredstrictbooleanoptionalcache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 2
typestringrequiredValues: web_search_20250305 · web_search_20260209
namestringrequiredValue: "web_search"
max_usesintegeroptionalDefault: 1
Minimum: 1
Maximum: 5
allowed_domainsarray | nulloptionalساختار داخلی
قالب 1
Array
قالب 2
null
blocked_domainsarray | nulloptionalساختار داخلی
قالب 1
Array
قالب 2
null
user_locationobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "approximate"
citystringoptionalMaximum length: 200
regionstringoptionalMaximum length: 200
countrystringoptionalMinimum length: 2
Maximum length: 2
timezonestringoptionalMaximum length: 100
قالب 2
null
cache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 3
typestringrequiredValue: "web_fetch_20250910"
namestringrequiredValue: "web_fetch"
max_usesintegeroptionalDefault: 1
Minimum: 1
Maximum: 5
max_content_tokensintegeroptionalDefault: 8000
Minimum: 1
Maximum: 32000
allowed_domainsarray | nulloptionalساختار داخلی
قالب 1
Array
قالب 2
null
blocked_domainsarray | nulloptionalساختار داخلی
قالب 1
Array
قالب 2
null
citationsobjectoptionalساختار داخلی
enabledbooleanrequiredcache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 4
typestringrequiredValues: computer_20250124 · computer_20251124
namestringrequiredValue: "computer"
display_width_pxintegerrequiredMinimum: 1
Maximum: 8192
display_height_pxintegerrequiredMinimum: 1
Maximum: 8192
display_numberintegeroptionalMinimum: 0
Maximum: 100
enable_zoombooleanoptionalcache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 5
قالب 1
typestringrequiredValue: "bash_20250124"
namestringrequiredValue: "bash"
cache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 2
typestringrequiredValues: text_editor_20250124 · text_editor_20250728
namestringrequiredValues: str_replace_editor · str_replace_based_edit_tool
cache_controlobject | nulloptionalساختار داخلی
قالب 1
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
قالب 2
null
قالب 6
typestringrequiredValues: openrouter:web_search · openrouter:web_fetch · openrouter:datetime · openrouter:bash
tool_choiceobject | object | objectoptionalساختار داخلی
قالب 1
typestringrequiredValues: auto · any
disable_parallel_tool_usebooleanoptionalقالب 2
typestringrequiredValue: "tool"
namestringrequiredMaximum length: 100
disable_parallel_tool_usebooleanoptionalقالب 3
typestringrequiredValue: "none"
thinkingobject | object | objectoptionalساختار داخلی
قالب 1
typestringrequiredValue: "enabled"
budget_tokensintegerrequiredMinimum: 1024
Maximum: 32767
displaystringoptionalValues: summarized · omitted
قالب 2
typestringrequiredValue: "adaptive"
displaystringoptionalValues: summarized · omitted
قالب 3
typestringrequiredValue: "disabled"
cache_controlobjectoptionalساختار داخلی
typestringrequiredValue: "ephemeral"
ttlstringoptionalValues: 5m · 1h
stop_sequencesarrayoptionalMaximum items: 20
ساختار داخلی
string
metadataobjectoptionalساختار داخلی
user_idstring | nulloptionalساختار داخلی
قالب 1
string
قالب 2
null
output_configobjectoptionalساختار داخلی
effortstringoptionalValues: low · medium · high · max
formatobjectoptionalساختار داخلی
typestringrequiredValue: "json_schema"
schemaobjectrequiredپارامترها و هدرها
[
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
},
{
"name": "anthropic-version",
"in": "header",
"required": true,
"schema": {
"const": "2023-06-01"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/messages/batches",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Anthropic-shaped error with the Sarovi request ID.
typeobjectrequiredValue: "error"
request_idstringoptionalerrorobjectrequiredساختار داخلی
typestringrequiredmessagestringrequiredقرارداد کامل OpenAPI
{
"summary": "Create durable Messages batch",
"description": "Up to 1,000 unique custom_id requests, 4 MB total. Each params object must use stream:false or omit stream. Uses the Sarovi durable queue at normal usage prices; no provider batch discount. Results are retained for 7 days.",
"operationId": "post__v1_messages_batches",
"security": [
{
"AnthropicKey": []
},
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
},
{
"name": "anthropic-version",
"in": "header",
"required": true,
"schema": {
"const": "2023-06-01"
}
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Anthropic-shaped error with the Sarovi request ID.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AnthropicError"
}
}
}
}
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"required": [
"requests"
],
"properties": {
"requests": {
"type": "array",
"minItems": 1,
"maxItems": 1000,
"items": {
"type": "object",
"required": [
"custom_id",
"params"
],
"additionalProperties": false,
"properties": {
"custom_id": {
"type": "string",
"pattern": "^[a-zA-Z0-9_-]{1,64}$"
},
"params": {
"$ref": "#/components/schemas/AnthropicRequest"
}
}
}
}
}
}
}
}
},
"tags": [
"messages"
]
}GET/v1/messages/batches
List Messages batches
Required scope: usage:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "limit",
"in": "query",
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 20
}
},
{
"name": "after_id",
"in": "query",
"description": "A Messages batch ID in this project. Use only one cursor per request.",
"schema": {
"type": "string",
"pattern": "^msgbatch_[0-9a-f-]{36}$"
}
},
{
"name": "before_id",
"in": "query",
"description": "A Messages batch ID in this project. Use only one cursor per request.",
"schema": {
"type": "string",
"pattern": "^msgbatch_[0-9a-f-]{36}$"
}
},
{
"name": "anthropic-version",
"in": "header",
"required": true,
"schema": {
"const": "2023-06-01"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/messages/batches",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Anthropic-shaped error with the Sarovi request ID.
typeobjectrequiredValue: "error"
request_idstringoptionalerrorobjectrequiredساختار داخلی
typestringrequiredmessagestringrequiredقرارداد کامل OpenAPI
{
"summary": "List Messages batches",
"description": "Required scope: usage:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "get__v1_messages_batches",
"security": [
{
"AnthropicKey": []
},
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "limit",
"in": "query",
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 20
}
},
{
"name": "after_id",
"in": "query",
"description": "A Messages batch ID in this project. Use only one cursor per request.",
"schema": {
"type": "string",
"pattern": "^msgbatch_[0-9a-f-]{36}$"
}
},
{
"name": "before_id",
"in": "query",
"description": "A Messages batch ID in this project. Use only one cursor per request.",
"schema": {
"type": "string",
"pattern": "^msgbatch_[0-9a-f-]{36}$"
}
},
{
"name": "anthropic-version",
"in": "header",
"required": true,
"schema": {
"const": "2023-06-01"
}
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Anthropic-shaped error with the Sarovi request ID.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AnthropicError"
}
}
}
}
},
"tags": [
"messages"
]
}GET/v1/messages/batches/{id}
Retrieve Messages batch
Required scope: usage:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"pattern": "^msgbatch_[0-9a-f-]{36}$"
}
},
{
"name": "anthropic-version",
"in": "header",
"required": true,
"schema": {
"const": "2023-06-01"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/messages/batches/{id}",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Anthropic-shaped error with the Sarovi request ID.
typeobjectrequiredValue: "error"
request_idstringoptionalerrorobjectrequiredساختار داخلی
typestringrequiredmessagestringrequiredقرارداد کامل OpenAPI
{
"summary": "Retrieve Messages batch",
"description": "Required scope: usage:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "get__v1_messages_batches_id_",
"security": [
{
"AnthropicKey": []
},
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"pattern": "^msgbatch_[0-9a-f-]{36}$"
}
},
{
"name": "anthropic-version",
"in": "header",
"required": true,
"schema": {
"const": "2023-06-01"
}
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Anthropic-shaped error with the Sarovi request ID.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AnthropicError"
}
}
}
}
},
"tags": [
"messages"
]
}POST/v1/messages/batches/{id}/cancel
Cancel queued Messages requests
Required scope: responses:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"pattern": "^msgbatch_[0-9a-f-]{36}$"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
},
{
"name": "anthropic-version",
"in": "header",
"required": true,
"schema": {
"const": "2023-06-01"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
payload = {
}
request = urllib.request.Request(
"https://api.sarovi.ir/v1/messages/batches/{id}/cancel",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
Success
object
default
Anthropic-shaped error with the Sarovi request ID.
typeobjectrequiredValue: "error"
request_idstringoptionalerrorobjectrequiredساختار داخلی
typestringrequiredmessagestringrequiredقرارداد کامل OpenAPI
{
"summary": "Cancel queued Messages requests",
"description": "Required scope: responses:write. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "post__v1_messages_batches_id_cancel",
"security": [
{
"AnthropicKey": []
},
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"pattern": "^msgbatch_[0-9a-f-]{36}$"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"schema": {
"type": "string",
"maxLength": 128
},
"description": "Stable unique key per logical request. Replays JSON below 1 MB for 24 hours; otherwise returns REQUEST_ALREADY_ACCEPTED."
},
{
"name": "anthropic-version",
"in": "header",
"required": true,
"schema": {
"const": "2023-06-01"
}
}
],
"responses": {
"200": {
"description": "Success",
"headers": {
"X-Request-ID": {
"schema": {
"type": "string",
"format": "uuid"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"default": {
"description": "Anthropic-shaped error with the Sarovi request ID.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AnthropicError"
}
}
}
}
},
"tags": [
"messages"
]
}GET/v1/messages/batches/{id}/results
Messages batch results as JSONL
Required scope: usage:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.
پیوند این مسیرپارامترها و هدرها
[
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"pattern": "^msgbatch_[0-9a-f-]{36}$"
}
},
{
"name": "anthropic-version",
"in": "header",
"required": true,
"schema": {
"const": "2023-06-01"
}
}
]نمونهٔ درخواست
import json, os, urllib.request, urllib.error
request = urllib.request.Request(
"https://api.sarovi.ir/v1/messages/batches/{id}/results",
headers={
"Authorization": "Bearer " + os.environ["SAROVI_API_KEY"],
"Content-Type": "application/json"
},
method="GET"
)
try:
with urllib.request.urlopen(request, timeout=300) as response:
result = json.load(response)
print(result)
except urllib.error.HTTPError as error:
detail = json.load(error)
raise RuntimeError(f"{error.code}: {detail['error'].get('code', detail['error'].get('type', 'HTTP_ERROR'))}") from errorکلید را در متغیر محیطی SAROVI_API_KEY قرار بده. بدون نصب کتابخانه؛ با Python استاندارد.
پاسخها
200
One custom_id and result per line. Requires ended processing_status.
See the full schema below.
default
Anthropic-shaped error with the Sarovi request ID.
typeobjectrequiredValue: "error"
request_idstringoptionalerrorobjectrequiredساختار داخلی
typestringrequiredmessagestringrequiredقرارداد کامل OpenAPI
{
"summary": "Messages batch results as JSONL",
"description": "Required scope: usage:read. Credits are shared with the Sarovi account. See /developers/docs for limits and billing.",
"operationId": "get__v1_messages_batches_id_results",
"security": [
{
"AnthropicKey": []
},
{
"BearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"pattern": "^msgbatch_[0-9a-f-]{36}$"
}
},
{
"name": "anthropic-version",
"in": "header",
"required": true,
"schema": {
"const": "2023-06-01"
}
}
],
"responses": {
"200": {
"description": "One custom_id and result per line. Requires ended processing_status.",
"content": {
"application/x-jsonl": {
"schema": {
"type": "string"
}
}
}
},
"default": {
"description": "Anthropic-shaped error with the Sarovi request ID.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AnthropicError"
}
}
}
}
},
"tags": [
"messages"
]
}قرارداد API 1.6.0 · تاریخچهٔ تغییرات