رفتن به محتوا
سارویتوسعه‌دهندگان
مستندات/مرجع و تغییرات

مرجع 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.

پیوند این مسیر

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

modelstringoptional

Maximum length: 200

Default: "z-ai/glm-5.3-flash"

messagesarrayrequired

Minimum items: 1

Maximum items: 1000

ساختار داخلی
rolestringrequired

Values: system · developer · user · assistant · tool

contentobject | nulloptional
ساختار داخلی
قالب 1
قالب 1

string

قالب 2

Array

قالب 2

null

refusalstring | nulloptional
ساختار داخلی
قالب 1

string

قالب 2

null

namestringoptional
tool_call_idstringoptional

Maximum length: 200

tool_callsarrayoptional

Maximum items: 128

ساختار داخلی
idstringrequired

Minimum length: 1

Maximum length: 200

indexintegeroptional

Minimum: 0

Maximum: 127

typestringrequired

Value: "function"

functionobjectrequired
ساختار داخلی
namestringrequired
argumentsstringrequired

Maximum length: 1000000

reasoningstring | nulloptional
ساختار داخلی
قالب 1

string

قالب 2

null

reasoning_contentstring | nulloptional
ساختار داخلی
قالب 1

string

قالب 2

null

reasoning_detailsarrayoptional

Maximum items: 100

ساختار داخلی

object

toolsarrayoptional

Maximum items: 128

ساختار داخلی
typestringrequired

Value: "function"

functionobjectrequired
ساختار داخلی
namestringrequired
descriptionstringoptional

Maximum length: 16000

parametersobjectrequired
strictbooleanoptional
tool_choicestring | objectoptional
ساختار داخلی
قالب 1

string

قالب 2
typestringrequired

Value: "function"

functionobjectrequired
ساختار داخلی
namestringrequired
parallel_tool_callsbooleanoptional
response_formatobject | object | objectoptional
ساختار داخلی
قالب 1
typestringrequired

Value: "text"

قالب 2
typestringrequired

Value: "json_object"

قالب 3
typestringrequired

Value: "json_schema"

json_schemaobjectrequired
ساختار داخلی
namestringrequired
descriptionstringoptional

Maximum length: 16000

schemaobjectrequired
strictbooleanoptional

Default: true

streambooleanoptional

Default: false

stream_optionsobjectoptional
ساختار داخلی
include_usagebooleanoptional
max_tokensintegeroptional

Minimum: 1

Maximum: 32768

max_completion_tokensintegeroptional

Minimum: 1

Maximum: 32768

temperaturenumberoptional

Minimum: 0

Maximum: 2

top_pnumberoptional

Minimum: 0

Maximum: 1

top_kintegeroptional

Minimum: 0

Maximum: 9007199254740991

repetition_penaltynumberoptional

Minimum: 0

Maximum: 2

seedintegeroptional

Minimum: -9007199254740991

Maximum: 9007199254740991

stopstring | arrayoptional
ساختار داخلی
قالب 1

string

قالب 2

Array

frequency_penaltynumberoptional

Minimum: -2

Maximum: 2

presence_penaltynumberoptional

Minimum: -2

Maximum: 2

reasoning_effortstringoptional
reasoningobjectoptional
ساختار داخلی
effortstringoptional
max_tokensintegeroptional

Minimum: 1

Maximum: 32768

excludebooleanoptional
enabledbooleanoptional
nnumberoptional

Value: 1

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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.

idstringrequired
objectobjectrequired

Value: "chat.completion"

createdintegeroptional

Minimum: 0

modelstringrequired
choicesarrayrequired
ساختار داخلی
indexintegerrequired

Minimum: 0

messageobjectrequired
ساختار داخلی
roleobjectrequired

Value: "assistant"

contentstring | nulloptional
tool_callsarrayoptional
ساختار داخلی
idstringrequired
typeobjectrequired

Value: "function"

functionobjectrequired
ساختار داخلی
namestringrequired
argumentsstringrequired
refusalstring | nulloptional
finish_reasonstring | nullrequired
usageobjectrequired
ساختار داخلی
prompt_tokensintegerrequired

Minimum: 0

completion_tokensintegerrequired

Minimum: 0

total_tokensintegerrequired

Minimum: 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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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
modelstringoptional

Values: 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

instructionsstringoptional

Maximum length: 12000

max_output_tokensintegeroptional

Default: 2048

Minimum: 128

Maximum: 32768

reasoning_effortstringoptional
reasoningobjectoptional
ساختار داخلی
effortstringrequired
include_reasoningbooleanoptional

Default: false

streambooleanoptional

Default: false

web_searchbooleanoptional

Default: false

قالب 2
modelstringoptional

Maximum length: 200

Default: "z-ai/glm-5.3-flash"

inputstring | arrayrequired
ساختار داخلی
قالب 1

string

قالب 2

Array

instructionsstringoptional

Maximum length: 12000

max_output_tokensintegeroptional

Default: 2048

Minimum: 1

Maximum: 32768

toolsarrayoptional

Maximum items: 128

ساختار داخلی
typestringrequired

Value: "function"

namestringrequired
descriptionstringoptional

Maximum length: 16000

parametersobjectrequired
strictbooleanoptional
tool_choicestring | objectoptional
ساختار داخلی
قالب 1

string

قالب 2
typestringrequired

Value: "function"

namestringrequired
parallel_tool_callsbooleanoptional
streambooleanoptional

Default: false

reasoning_effortstringoptional
textobjectoptional
ساختار داخلی
formatobject | object | objectrequired
ساختار داخلی
قالب 1
typestringrequired

Value: "text"

قالب 2
typestringrequired

Value: "json_object"

قالب 3
typestringrequired

Value: "json_schema"

namestringrequired
descriptionstringoptional
schemaobjectrequired
strictbooleanoptional

Default: true

verbositystringoptional

Values: low · medium · high

reasoningobjectoptional
ساختار داخلی
effortstringoptional
summarystringoptional

Values: auto · concise · detailed

temperaturenumberoptional

Minimum: 0

Maximum: 2

top_pnumberoptional

Minimum: 0

Maximum: 1

storebooleanoptional

Value: false

قالب 3
modelstringrequired

Values: 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

instructionsstringoptional

Maximum length: 8000

toolsarrayoptional

Maximum items: 1

ساختار داخلی
typestringrequired

Value: "image_generation"

modelstringoptional

Values: 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

qualitystringoptional

Values: auto · low · medium · high

output_formatstringoptional

Values: png · jpeg · webp

backgroundstringoptional

Values: auto · opaque · transparent

sizestringoptional
aspect_ratiostringoptional

Maximum length: 24

fitstringoptional

Values: pad · crop

actionstringoptional

Values: auto · generate · edit

tool_choicestring | objectoptional
ساختار داخلی
قالب 1

string

قالب 2
typestringrequired

Value: "image_generation"

streambooleanoptional

Default: false

storebooleanoptional

Value: false

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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.

idstringoptional
objectobjectoptional

Value: "response"

modelstringoptional
statusobjectoptional

Values: completed · incomplete

output_textstringoptional
reasoningobjectoptional

Present only when include_reasoning=true. Provider output; availability varies.

ساختار داخلی
statusobjectoptional

Values: available · unavailable

textstringoptional
formatobjectoptional

Values: summary · text

sourceobjectoptional

Value: "provider"

outputarrayoptional
ساختار داخلی

object

usageobjectoptional
ساختار داخلی
input_tokensintegeroptional
output_tokensintegeroptional
total_tokensintegeroptional
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

promptstringrequired

Minimum length: 3

Maximum length: 8000

presetstringoptional

Values: fast · balanced · quality

Default: "balanced"

modelstringoptional

Values: 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

aspectRatiostringoptional

auto follows the prompt or reference. Omitted settings preserve the legacy 1:1 default.

Maximum length: 24

sizestringoptional

Exact export WIDTHxHEIGHT or auto. Export is resized without distortion; fit defaults to pad.

fitstringoptional

pad preserves the full image with borders; crop fills the requested canvas. Applies to custom export sizes and non-native ratios.

Values: pad · crop

qualitystringoptional

Values: low · medium · high

Default: "medium"

outputFormatstringoptional

Values: png · jpeg · webp

Default: "png"

transparentbooleanoptional

Default: false

countintegeroptional

Default: 1

Minimum: 1

Maximum: 4

referenceobjectoptional
ساختار داخلی
dataUrlstringrequired

Maximum length: 12000000

referencesarrayoptional

Minimum items: 1

Maximum items: 8

ساختار داخلی
dataUrlstringrequired

Maximum length: 12000000

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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

outputsarrayrequired

Minimum items: 1

Maximum items: 4

ساختار داخلی
datastringrequired

Minimum length: 16

Maximum length: 24000000

widthintegeroptional

Maximum: 9007199254740991

heightintegeroptional

Maximum: 9007199254740991

sizingobjectoptional
ساختار داخلی
sourcestringrequired

Values: settings · prompt · reference · default

fitstringrequired

Values: native · pad · crop

sourceWidthintegerrequired

Maximum: 9007199254740991

sourceHeightintegerrequired

Maximum: 9007199254740991

mediaTypestringrequired

Values: image/png · image/jpeg · image/webp · image/svg+xml

executionobjectrequired
ساختار داخلی
requestIdstringoptional

Minimum length: 1

Maximum length: 200

modelstringrequired

Minimum length: 1

Maximum length: 200

inputTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

outputTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

totalTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

costUsdnumberoptional

Minimum: 0

Maximum: 10000

researchobjectoptional
ساختار داخلی
searchedbooleanrequired

Value: true

sourcesarrayrequired

Maximum items: 8

ساختار داخلی
urlstringrequired

Maximum length: 2048

titlestringrequired

Minimum 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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

textstringoptional

Minimum length: 1

Maximum length: 12000

presetstringoptional

Values: fast · balanced · quality

Default: "balanced"

modelstringoptional

Values: 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

voicestringoptional

Minimum length: 1

Maximum length: 80

formatstringoptional

Values: mp3 · wav · pcm

Default: "mp3"

speednumberoptional

Current audio models use natural speed. Gemini pacing is controlled through instructions.

Value: 1

Default: 1

instructionsstringoptional

Maximum length: 2000

turnsarrayoptional

Minimum items: 2

Maximum items: 40

ساختار داخلی
textstringrequired

Minimum length: 1

Maximum length: 12000

voicestringrequired

Minimum length: 1

Maximum length: 80

instructionsstringoptional

Maximum length: 1000

audioInputobjectoptional
ساختار داخلی
audioBase64stringrequired

Minimum length: 16

Maximum length: 18666668

mediaTypestringrequired

Values: audio/webm · audio/mp4 · audio/mpeg · audio/wav · audio/ogg · audio/flac · audio/aac

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
datastringrequired

Minimum length: 16

Maximum length: 40000000

mediaTypestringrequired

Values: audio/mpeg · audio/wav · audio/pcm

executionobjectrequired
ساختار داخلی
requestIdstringoptional

Minimum length: 1

Maximum length: 200

modelstringrequired

Minimum length: 1

Maximum length: 200

inputTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

outputTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

totalTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

costUsdnumberoptional

Minimum: 0

Maximum: 10000

researchobjectoptional
ساختار داخلی
searchedbooleanrequired

Value: true

sourcesarrayrequired

Maximum items: 8

ساختار داخلی
urlstringrequired

Maximum length: 2048

titlestringrequired

Minimum 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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

promptstringrequired

Minimum length: 1

Maximum length: 12000

presetstringoptional

Values: fast · balanced · quality

Default: "balanced"

modelstringoptional

Values: 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

reasoningEffortstringoptional
maxOutputTokensintegeroptional

Default: 2048

Minimum: 128

Maximum: 8192

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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

textstringrequired

Minimum length: 1

Maximum length: 64000

executionobjectrequired
ساختار داخلی
requestIdstringoptional

Minimum length: 1

Maximum length: 200

modelstringrequired

Minimum length: 1

Maximum length: 200

inputTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

outputTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

totalTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

costUsdnumberoptional

Minimum: 0

Maximum: 10000

researchobjectoptional
ساختار داخلی
searchedbooleanrequired

Value: true

sourcesarrayrequired

Maximum items: 8

ساختار داخلی
urlstringrequired

Maximum length: 2048

titlestringrequired

Minimum 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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

promptstringrequired

Minimum length: 3

Maximum length: 8000

presetstringoptional

Values: fast · balanced · quality

Default: "balanced"

modelstringoptional

Values: 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

aspectRatiostringoptional

Values: 1:1 · 16:9 · 9:16 · 4:3 · 3:4 · 3:2 · 2:3 · 21:9

Default: "16:9"

durationintegeroptional

Default: 6

Minimum: 1

Maximum: 30

resolutionstringoptional

Values: 480p · 720p · 1080p

Default: "720p"

generateAudiobooleanoptional

Default: false

referenceobjectoptional
ساختار داخلی
dataUrlstringrequired

Maximum length: 12000000

referencesarrayoptional

Minimum items: 1

Maximum items: 8

ساختار داخلی
dataUrlstringrequired

Maximum length: 12000000

referenceModestringoptional

Values: guide · frames

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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.

providerJobIdstringrequired

Minimum length: 1

Maximum length: 300

statusstringrequired

Values: pending · processing · completed · failed

executionobjectoptional
ساختار داخلی
requestIdstringoptional

Minimum length: 1

Maximum length: 200

modelstringrequired

Minimum length: 1

Maximum length: 200

inputTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

outputTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

totalTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

costUsdnumberoptional

Minimum: 0

Maximum: 10000

researchobjectoptional
ساختار داخلی
searchedbooleanrequired

Value: true

sourcesarrayrequired

Maximum items: 8

ساختار داخلی
urlstringrequired

Maximum length: 2048

titlestringrequired

Minimum 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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

idstringrequired
providerJobIdstringrequired

Minimum length: 1

Maximum length: 300

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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

statusstringrequired

Values: pending · processing · completed · failed

contentUrlstringoptional

Maximum length: 4096

errorstringoptional

Maximum length: 400

errorCodestringoptional

Maximum length: 80

retryablebooleanoptional
executionobjectoptional
ساختار داخلی
requestIdstringoptional

Minimum length: 1

Maximum length: 200

modelstringrequired

Minimum length: 1

Maximum length: 200

inputTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

outputTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

totalTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

costUsdnumberoptional

Minimum: 0

Maximum: 10000

researchobjectoptional
ساختار داخلی
searchedbooleanrequired

Value: true

sourcesarrayrequired

Maximum items: 8

ساختار داخلی
urlstringrequired

Maximum length: 2048

titlestringrequired

Minimum 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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

idstringrequired
providerJobIdstringrequired

Minimum length: 1

Maximum length: 300

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

audioBase64stringrequired

Minimum length: 16

Maximum length: 18666668

mediaTypestringrequired

Values: audio/webm · audio/mp4 · audio/mpeg · audio/wav · audio/ogg · audio/flac · audio/aac

modelstringoptional

Values: openai/whisper-large-v3 · openai/whisper-large-v3-turbo

languagestringoptional
پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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

textstringrequired

Minimum length: 1

Maximum length: 32000

executionobjectoptional
ساختار داخلی
requestIdstringoptional

Minimum length: 1

Maximum length: 200

modelstringrequired

Minimum length: 1

Maximum length: 200

inputTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

outputTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

totalTokensintegerrequired

Minimum: 0

Maximum: 9007199254740991

costUsdnumberoptional

Minimum: 0

Maximum: 10000

researchobjectoptional
ساختار داخلی
searchedbooleanrequired

Value: true

sourcesarrayrequired

Maximum items: 8

ساختار داخلی
urlstringrequired

Maximum length: 2048

titlestringrequired

Minimum 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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

sdpstringrequired

Minimum length: 20

Maximum length: 200000

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

callIdstringrequired

Minimum length: 4

Maximum length: 160

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

namestringrequired

Minimum length: 1

Maximum length: 80

instructionsstringoptional

Maximum length: 12000

Default: ""

modelstringoptional

Values: 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"

kindstringoptional

Values: chat · research · document · code · data

Default: "chat"

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

namestringoptional

Minimum length: 1

Maximum length: 80

instructionsstringoptional

Maximum length: 12000

modelstringoptional

Maximum length: 200

پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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

idstringrequired
project_idstringrequired
namestringrequired
instructionsstringrequired
modelstringrequired
kindobjectrequired

Values: chat · research · document · code · data

created_atstringoptional
updated_atstringoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

inputstringrequired

Minimum length: 1

Maximum length: 12000

streambooleanoptional
include_reasoningbooleanoptional
reasoning_effortstringoptional
reasoningobjectoptional
ساختار داخلی
effortstringrequired
پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

kindstringrequired

Values: research · document · code · data

inputstringrequired

Minimum length: 10

Maximum length: 12000

titlestringoptional

Minimum length: 1

Maximum length: 100

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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.

idstringrequired
objectobjectrequired

Value: "run"

statusobjectrequired

Value: "queued"

status_urlstringrequired
files_urlstringrequired
reserved_creditsintegerrequired

Minimum: 0

request_idstringoptional
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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"
      ]
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

namestringrequired

Minimum length: 1

Maximum length: 80

instructionsstringoptional

Maximum length: 8000

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

نمونهٔ درخواست

Python
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_creditsintegerrequired

Minimum: 0

planstringrequired
currencyobjectrequired

Value: "sarovi_credits"

shared_balanceobjectrequired

Value: 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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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.

dataarrayrequired

Maximum items: 1

ساختار داخلی
idstringrequired
idempotency_keystringrequired
endpointstringrequired
stateobjectrequired

Values: running · completed · failed

status_codeinteger | nulloptional
creditsintegerrequired

Minimum: 0

pendingbooleanrequired
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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
planstringrequired

Value: "starter"

namestringrequired

Minimum length: 2

Maximum length: 80

قالب 2
namestringrequired

Minimum length: 2

Maximum length: 80

regionstringoptional

Values: emea · apac · americas

Default: "emea"

instance_sizestringoptional

Values: micro · small · medium

Default: "micro"

confirm_purchasebooleanrequired

Value: true

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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_deletebooleanrequired

Value: true

پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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_deletebooleanrequired

Value: true

پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  },
  {
    "name": "siteId",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  },
  {
    "name": "siteId",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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
querystringrequired

Minimum length: 1

Maximum length: 40000

read_onlybooleanoptional

Default: true

confirm_writebooleanoptional

Default: false

قالب 2
actionstringrequired

Values: create_collection · list · insert · update · delete

tablestringoptional
namestringoptional
idstringoptional
dataobjectoptional
public_readbooleanoptional
offsetintegeroptional

Minimum: 0

Maximum: 2000

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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_urlstringrequired
disable_signupbooleanoptional

Default: false

پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

namestringrequired
publicbooleanoptional

Default: false

file_size_limitintegeroptional

Default: 10485760

Minimum: 1

Maximum: 52428800

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

namestringrequired
codestringrequired

Minimum length: 1

Maximum length: 128000

verify_jwtbooleanoptional

Default: true

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

namestringrequired
valuestringrequired

Minimum length: 1

Maximum length: 10000

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

namestringrequired

Minimum length: 2

Maximum length: 80

filesarrayrequired

Minimum items: 1

Maximum items: 100

ساختار داخلی
pathstringrequired

Minimum length: 1

Maximum length: 200

contentstringrequired

Maximum length: 2000000

encodingstringoptional

Values: utf8 · base64

Default: "utf8"

confirm_publicbooleanrequired

Value: true

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

filesarrayrequired

Minimum items: 1

Maximum items: 100

ساختار داخلی
pathstringrequired

Minimum length: 1

Maximum length: 200

contentstringrequired

Maximum length: 2000000

encodingstringoptional

Values: utf8 · base64

Default: "utf8"

confirm_publicbooleanrequired

Value: true

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

نمونهٔ درخواست

Python
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
ساختار داخلی
idobjectrequired

Values: support · sales · receptionist

namestringrequired
descriptionstringrequired
instructionsstringrequired
collect_leadsbooleanoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

نمونهٔ درخواست

Python
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
ساختار داخلی
idstringrequired
project_idstringoptional
key_idstring | nulloptional
namestringrequired
statusobjectrequired

Values: queued · running · completed · cancelled

totalintegerrequired

Minimum: 0

succeededintegerrequired

Minimum: 0

failedintegerrequired

Minimum: 0

cancelledintegerrequired

Minimum: 0

cancel_requestedbooleanoptional
max_creditsintegerrequired

Minimum: 0

creditsintegerrequired

Minimum: 0

customer_idstring | nulloptional
created_atstringoptional
completed_atstring | nulloptional
expires_atstringoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

namestringoptional

Minimum length: 1

Maximum length: 100

Default: "پردازش گروهی"

requestsarrayrequired

Minimum items: 1

Maximum items: 1000

ساختار داخلی
custom_idstringrequired

Minimum length: 1

Maximum length: 120

bodyobjectrequired
ساختار داخلی
modelstringoptional

Minimum length: 1

Maximum length: 200

Default: "z-ai/glm-5.3-flash"

inputstringrequired

Minimum length: 1

Maximum length: 32000

instructionsstringoptional

Maximum length: 8000

max_output_tokensintegeroptional

Default: 512

Minimum: 128

Maximum: 2048

max_creditsintegerrequired

Minimum: 1

Maximum: 10000000

customer_idstringoptional

Minimum length: 1

Maximum length: 120

پارامترها و هدرها
JSON
[
  {
    "name": "Idempotency-Key",
    "in": "header",
    "schema": {
      "type": "string"
    },
    "description": "Reuse this value when retrying the identical request."
  }
]

نمونهٔ درخواست

Python
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.

idstringrequired
project_idstringoptional
key_idstring | nulloptional
namestringrequired
statusobjectrequired

Values: queued · running · completed · cancelled

totalintegerrequired

Minimum: 0

succeededintegerrequired

Minimum: 0

failedintegerrequired

Minimum: 0

cancelledintegerrequired

Minimum: 0

cancel_requestedbooleanoptional
max_creditsintegerrequired

Minimum: 0

creditsintegerrequired

Minimum: 0

customer_idstring | nulloptional
created_atstringoptional
completed_atstring | nulloptional
expires_atstringoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

namestringoptional

Minimum length: 1

Maximum length: 100

Default: "پردازش گروهی"

requestsarrayrequired

Minimum items: 1

Maximum items: 1000

ساختار داخلی
custom_idstringrequired

Minimum length: 1

Maximum length: 120

bodyobjectrequired
ساختار داخلی
modelstringoptional

Minimum length: 1

Maximum length: 200

Default: "z-ai/glm-5.3-flash"

inputstringrequired

Minimum length: 1

Maximum length: 32000

instructionsstringoptional

Maximum length: 8000

max_output_tokensintegeroptional

Default: 512

Minimum: 128

Maximum: 2048

max_creditsintegerrequired

Minimum: 1

Maximum: 10000000

customer_idstringoptional

Minimum length: 1

Maximum length: 120

پارامترها و هدرها
JSON
[
  {
    "name": "Idempotency-Key",
    "in": "header",
    "schema": {
      "type": "string"
    },
    "description": "Reuse this value when retrying the identical request."
  }
]

نمونهٔ درخواست

Python
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_idstringrequired
max_creditsintegerrequired

Minimum: 0

total_max_creditsintegerrequired

Minimum: 0

currencyobjectrequired

Value: "sarovi_credits"

pricingobjectrequired

Value: "standard"

discount_percentobjectoptional

Value: 0

default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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

idstringrequired
project_idstringoptional
key_idstring | nulloptional
namestringrequired
statusobjectrequired

Values: queued · running · completed · cancelled

totalintegerrequired

Minimum: 0

succeededintegerrequired

Minimum: 0

failedintegerrequired

Minimum: 0

cancelledintegerrequired

Minimum: 0

cancel_requestedbooleanoptional
max_creditsintegerrequired

Minimum: 0

creditsintegerrequired

Minimum: 0

customer_idstring | nulloptional
created_atstringoptional
completed_atstring | nulloptional
expires_atstringoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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

idstringrequired
project_idstringoptional
key_idstring | nulloptional
namestringrequired
statusobjectrequired

Values: queued · running · completed · cancelled

totalintegerrequired

Minimum: 0

succeededintegerrequired

Minimum: 0

failedintegerrequired

Minimum: 0

cancelledintegerrequired

Minimum: 0

cancel_requestedbooleanoptional
max_creditsintegerrequired

Minimum: 0

creditsintegerrequired

Minimum: 0

customer_idstring | nulloptional
created_atstringoptional
completed_atstring | nulloptional
expires_atstringoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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_creditsintegerrequired

Minimum: 1

Maximum: 10000000

include_uncertainbooleanoptional

Default: false

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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.

idstringrequired
project_idstringoptional
key_idstring | nulloptional
namestringrequired
statusobjectrequired

Values: queued · running · completed · cancelled

totalintegerrequired

Minimum: 0

succeededintegerrequired

Minimum: 0

failedintegerrequired

Minimum: 0

cancelledintegerrequired

Minimum: 0

cancel_requestedbooleanoptional
max_creditsintegerrequired

Minimum: 0

creditsintegerrequired

Minimum: 0

customer_idstring | nulloptional
created_atstringoptional
completed_atstring | nulloptional
expires_atstringoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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"
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
idstringoptional
custom_idstringrequired
statusobjectrequired

Values: queued · running · succeeded · failed · cancelled

request_idstringrequired
resultobject | nulloptional
ساختار داخلی
idstringoptional
output_textstringoptional
statusstringoptional
usageobjectoptional
errorobject | nulloptional
ساختار داخلی
codestringoptional
messagestringoptional
request_idstringoptional
bodyobject | nulloptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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_idstringoptional
draftobjectoptional
ساختار داخلی
enabledbooleanoptional

Default: true

max_input_charsintegeroptional

Default: 12000

Minimum: 100

Maximum: 12000

max_stepsintegeroptional

Default: 4

Minimum: 1

Maximum: 4

require_knowledgebooleanoptional

Default: false

templatestringoptional

Values: support · sales · receptionist · custom

Default: "support"

knowledge_idsarrayoptional

Maximum items: 5

Default: []

ساختار داخلی

string

greetingstringoptional

Maximum length: 500

Default: "سلام! چطور می‌توانم کمکتان کنم؟"

max_creditsintegeroptional

Default: 300

Minimum: 1

Maximum: 100000

max_output_tokensintegeroptional

Default: 512

Minimum: 128

Maximum: 2048

collect_leadsbooleanoptional

Default: false

allow_handoffbooleanoptional

Default: true

retention_daysnumber | numberoptional

Default: 7

ساختار داخلی
قالب 1

number

قالب 2

number

published_versioninteger | nulloptional
publishedobject | nulloptional
ساختار داخلی
agentobjectoptional
configobjectoptional
ساختار داخلی
enabledbooleanoptional

Default: true

max_input_charsintegeroptional

Default: 12000

Minimum: 100

Maximum: 12000

max_stepsintegeroptional

Default: 4

Minimum: 1

Maximum: 4

require_knowledgebooleanoptional

Default: false

templatestringoptional

Values: support · sales · receptionist · custom

Default: "support"

knowledge_idsarrayoptional

Maximum items: 5

Default: []

ساختار داخلی

string

greetingstringoptional

Maximum length: 500

Default: "سلام! چطور می‌توانم کمکتان کنم؟"

max_creditsintegeroptional

Default: 300

Minimum: 1

Maximum: 100000

max_output_tokensintegeroptional

Default: 512

Minimum: 128

Maximum: 2048

collect_leadsbooleanoptional

Default: false

allow_handoffbooleanoptional

Default: true

retention_daysnumber | numberoptional

Default: 7

ساختار داخلی
قالب 1

number

قالب 2

number

default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

enabledbooleanoptional

Default: true

max_input_charsintegeroptional

Default: 12000

Minimum: 100

Maximum: 12000

max_stepsintegeroptional

Default: 4

Minimum: 1

Maximum: 4

require_knowledgebooleanoptional

Default: false

templatestringoptional

Values: support · sales · receptionist · custom

Default: "support"

knowledge_idsarrayoptional

Maximum items: 5

Default: []

ساختار داخلی

string

greetingstringoptional

Maximum length: 500

Default: "سلام! چطور می‌توانم کمکتان کنم؟"

max_creditsintegeroptional

Default: 300

Minimum: 1

Maximum: 100000

max_output_tokensintegeroptional

Default: 512

Minimum: 128

Maximum: 2048

collect_leadsbooleanoptional

Default: false

allow_handoffbooleanoptional

Default: true

retention_daysnumber | numberoptional

Default: 7

ساختار داخلی
قالب 1

number

قالب 2

number

پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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_idstringoptional
draftobjectoptional
ساختار داخلی
enabledbooleanoptional

Default: true

max_input_charsintegeroptional

Default: 12000

Minimum: 100

Maximum: 12000

max_stepsintegeroptional

Default: 4

Minimum: 1

Maximum: 4

require_knowledgebooleanoptional

Default: false

templatestringoptional

Values: support · sales · receptionist · custom

Default: "support"

knowledge_idsarrayoptional

Maximum items: 5

Default: []

ساختار داخلی

string

greetingstringoptional

Maximum length: 500

Default: "سلام! چطور می‌توانم کمکتان کنم؟"

max_creditsintegeroptional

Default: 300

Minimum: 1

Maximum: 100000

max_output_tokensintegeroptional

Default: 512

Minimum: 128

Maximum: 2048

collect_leadsbooleanoptional

Default: false

allow_handoffbooleanoptional

Default: true

retention_daysnumber | numberoptional

Default: 7

ساختار داخلی
قالب 1

number

قالب 2

number

published_versioninteger | nulloptional
publishedobject | nulloptional
ساختار داخلی
agentobjectoptional
configobjectoptional
ساختار داخلی
enabledbooleanoptional

Default: true

max_input_charsintegeroptional

Default: 12000

Minimum: 100

Maximum: 12000

max_stepsintegeroptional

Default: 4

Minimum: 1

Maximum: 4

require_knowledgebooleanoptional

Default: false

templatestringoptional

Values: support · sales · receptionist · custom

Default: "support"

knowledge_idsarrayoptional

Maximum items: 5

Default: []

ساختار داخلی

string

greetingstringoptional

Maximum length: 500

Default: "سلام! چطور می‌توانم کمکتان کنم؟"

max_creditsintegeroptional

Default: 300

Minimum: 1

Maximum: 100000

max_output_tokensintegeroptional

Default: 512

Minimum: 128

Maximum: 2048

collect_leadsbooleanoptional

Default: false

allow_handoffbooleanoptional

Default: true

retention_daysnumber | numberoptional

Default: 7

ساختار داخلی
قالب 1

number

قالب 2

number

default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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_versionintegeroptional

Minimum: 1

Maximum: 9007199254740991

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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_idstringoptional
draftobjectoptional
ساختار داخلی
enabledbooleanoptional

Default: true

max_input_charsintegeroptional

Default: 12000

Minimum: 100

Maximum: 12000

max_stepsintegeroptional

Default: 4

Minimum: 1

Maximum: 4

require_knowledgebooleanoptional

Default: false

templatestringoptional

Values: support · sales · receptionist · custom

Default: "support"

knowledge_idsarrayoptional

Maximum items: 5

Default: []

ساختار داخلی

string

greetingstringoptional

Maximum length: 500

Default: "سلام! چطور می‌توانم کمکتان کنم؟"

max_creditsintegeroptional

Default: 300

Minimum: 1

Maximum: 100000

max_output_tokensintegeroptional

Default: 512

Minimum: 128

Maximum: 2048

collect_leadsbooleanoptional

Default: false

allow_handoffbooleanoptional

Default: true

retention_daysnumber | numberoptional

Default: 7

ساختار داخلی
قالب 1

number

قالب 2

number

published_versioninteger | nulloptional
publishedobject | nulloptional
ساختار داخلی
agentobjectoptional
configobjectoptional
ساختار داخلی
enabledbooleanoptional

Default: true

max_input_charsintegeroptional

Default: 12000

Minimum: 100

Maximum: 12000

max_stepsintegeroptional

Default: 4

Minimum: 1

Maximum: 4

require_knowledgebooleanoptional

Default: false

templatestringoptional

Values: support · sales · receptionist · custom

Default: "support"

knowledge_idsarrayoptional

Maximum items: 5

Default: []

ساختار داخلی

string

greetingstringoptional

Maximum length: 500

Default: "سلام! چطور می‌توانم کمکتان کنم؟"

max_creditsintegeroptional

Default: 300

Minimum: 1

Maximum: 100000

max_output_tokensintegeroptional

Default: 512

Minimum: 128

Maximum: 2048

collect_leadsbooleanoptional

Default: false

allow_handoffbooleanoptional

Default: true

retention_daysnumber | numberoptional

Default: 7

ساختار داخلی
قالب 1

number

قالب 2

number

default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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_idstringoptional
versionintegeroptional

Minimum: 0

snapshotobjectoptional
ساختار داخلی
agentobjectoptional
configobjectoptional
ساختار داخلی
enabledbooleanoptional

Default: true

max_input_charsintegeroptional

Default: 12000

Minimum: 100

Maximum: 12000

max_stepsintegeroptional

Default: 4

Minimum: 1

Maximum: 4

require_knowledgebooleanoptional

Default: false

templatestringoptional

Values: support · sales · receptionist · custom

Default: "support"

knowledge_idsarrayoptional

Maximum items: 5

Default: []

ساختار داخلی

string

greetingstringoptional

Maximum length: 500

Default: "سلام! چطور می‌توانم کمکتان کنم؟"

max_creditsintegeroptional

Default: 300

Minimum: 1

Maximum: 100000

max_output_tokensintegeroptional

Default: 512

Minimum: 128

Maximum: 2048

collect_leadsbooleanoptional

Default: false

allow_handoffbooleanoptional

Default: true

retention_daysnumber | numberoptional

Default: 7

ساختار داخلی
قالب 1

number

قالب 2

number

created_atstringoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

inputstringrequired

Minimum length: 1

Maximum length: 12000

customer_idstringrequired

Minimum length: 1

Maximum length: 120

conversation_idstringoptional
draftbooleanoptional

Default: false

پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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

idstringrequired
conversation_idstringrequired
agent_idstringrequired
customer_idstringrequired
versioninteger | nulloptional
statusobjectrequired

Value: "completed"

output_textstringrequired
sourcesarrayrequired
ساختار داخلی
idstringoptional
namestringoptional
indexintegeroptional

Minimum: 0

outcomesarrayrequired
ساختار داخلی
idstringrequired
typeobjectrequired

Values: agent.lead · agent.handoff

statusobjectrequired

Value: "requested"

namestringoptional
contactstringoptional
needstringoptional
reasonstringoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
idstringoptional
conversation_idstringoptional
versioninteger | nulloptional
statusstringoptional
resultobject | nulloptional
ساختار داخلی
output_textstringoptional
outcomesarrayoptional
ساختار داخلی
idstringrequired
typeobjectrequired

Values: agent.lead · agent.handoff

statusobjectrequired

Value: "requested"

namestringoptional
contactstringoptional
needstringoptional
reasonstringoptional
errorobjectoptional
ساختار داخلی
codestringoptional
created_atstringoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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"
  }
]

نمونهٔ درخواست

Python
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

idstringrequired
project_idstringoptional
agent_idstringrequired
customer_idstringrequired
messagesarrayrequired
ساختار داخلی
roleobjectoptional

Values: user · assistant

contentstringoptional
created_atstringoptional
updated_atstringoptional
expires_atstringoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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"
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

نمونهٔ درخواست

Python
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
ساختار داخلی
idstringrequired
namestringrequired
instructionsstringoptional
document_countintegeroptional

Minimum: 0

total_bytesintegeroptional

Minimum: 0

created_atstringoptional
updated_atstringoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

namestringrequired

Minimum length: 1

Maximum length: 80

instructionsstringoptional

Maximum length: 8000

پارامترها و هدرها
JSON
[
  {
    "name": "Idempotency-Key",
    "in": "header",
    "schema": {
      "type": "string"
    },
    "description": "Reuse this value when retrying the identical request."
  }
]

نمونهٔ درخواست

Python
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

idstringrequired
namestringrequired
instructionsstringoptional
document_countintegeroptional

Minimum: 0

total_bytesintegeroptional

Minimum: 0

created_atstringoptional
updated_atstringoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
idstringrequired
namestringrequired
instructionsstringoptional
document_countintegeroptional

Minimum: 0

total_bytesintegeroptional

Minimum: 0

created_atstringoptional
updated_atstringoptional
documentsarrayrequired
ساختار داخلی
idstringrequired
project_idstringrequired
namestringrequired
media_typestringoptional
size_bytesintegeroptional

Minimum: 0

sha256stringoptional
created_atstringoptional
updated_atstringoptional
conversationsarrayoptional
ساختار داخلی

object

memoriesarrayoptional
ساختار داخلی

object

sharedbooleanoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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

deletedbooleanoptional
idstringoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

namestringrequired

Minimum length: 1

Maximum length: 180

textstringoptional

Maximum length: 1500000

urlstringoptional
content_base64stringoptional

Maximum length: 2800000

media_typestringoptional
پارامترها و هدرها
JSON
[
  {
    "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."
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
idstringrequired
project_idstringrequired
namestringrequired
media_typestringoptional
size_bytesintegeroptional

Minimum: 0

sha256stringoptional
created_atstringoptional
updated_atstringoptional
statusobjectrequired

Value: "ready"

default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  },
  {
    "name": "documentId",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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

deletedbooleanoptional
idstringoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

نمونهٔ درخواست

Python
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
ساختار داخلی
idstringrequired
project_idstringoptional
urlstringrequired
eventsarrayrequired
ساختار داخلی

string

enabledbooleanrequired
created_atstringoptional
secretstringoptional

Returned only once on creation. Store on your server.

default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

urlstringrequired

Maximum length: 2048

eventsarrayrequired

Minimum items: 1

Maximum items: 5

ساختار داخلی

string

enabledbooleanoptional

Default: true

پارامترها و هدرها
JSON
[
  {
    "name": "Idempotency-Key",
    "in": "header",
    "schema": {
      "type": "string"
    },
    "description": "Reuse this value when retrying the identical request."
  }
]

نمونهٔ درخواست

Python
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

idstringrequired
project_idstringoptional
urlstringrequired
eventsarrayrequired
ساختار داخلی

string

enabledbooleanrequired
created_atstringoptional
secretstringoptional

Returned only once on creation. Store on your server.

default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
      "type": "string",
      "format": "uuid"
    }
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

نمونهٔ درخواست

Python
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
ساختار داخلی
idstringoptional
event_idstringoptional
webhook_idstringoptional
stateobjectoptional

Values: queued · sending · delivered · failed

attemptsintegeroptional

Minimum: 0

last_statusinteger | nulloptional
next_atstringoptional
created_atstringoptional
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

نمونهٔ درخواست

Python
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_limitintegerrequired

Minimum: 0

used_creditsintegerrequired

Minimum: 0

remaining_creditsintegerrequired

Minimum: 0

threshold_reachedbooleanrequired
resets_atstringrequired
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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"
  }
]

نمونهٔ درخواست

Python
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
ساختار داخلی
idstringrequired
created_atstringrequired
endpointstringrequired
modelstring | nulloptional
key_idstring | nulloptional
customer_idstring | nulloptional
reference_idstring | nulloptional
agent_idstring | nulloptional
batch_idstring | nulloptional
statestringrequired
status_codeinteger | nulloptional
error_codestring | nulloptional
creditsintegerrequired

Minimum: 0

pendingbooleanrequired
input_tokensintegeroptional

Minimum: 0

output_tokensintegeroptional

Minimum: 0

duration_msinteger | nulloptional
next_cursorstring | nullrequired
fromstringrequired
throughstringrequired
default

Structured API error; no successful completion is implied.

errorobjectrequired
ساختار داخلی
codestringrequired
messagestringrequired
paramstringoptional

Safe path of an invalid request field, when known.

execution_startedbooleanoptional

Present for validation rejected before execution.

Value: false

request_idstringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

modelstringrequired

Minimum length: 1

Maximum length: 200

max_tokensintegerrequired

Minimum: 1

Maximum: 32768

messagesarrayrequired

Minimum items: 1

Maximum items: 1000

ساختار داخلی
rolestringrequired

Values: user · assistant

contentstring | arrayrequired
ساختار داخلی
قالب 1

string

قالب 2

Array

systemstring | arrayoptional
ساختار داخلی
قالب 1

string

قالب 2

Array

streambooleanoptional

Default: false

temperaturenumberoptional

Minimum: 0

Maximum: 1

top_pnumberoptional

Minimum: 0

Maximum: 1

top_kintegeroptional

Minimum: 0

Maximum: 9007199254740991

toolsarrayoptional

Maximum items: 128

ساختار داخلی
قالب 1
typestringoptional

Value: "custom"

namestringrequired
descriptionstringoptional

Maximum length: 16000

input_schemaobjectrequired
strictbooleanoptional
cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 2
typestringrequired

Values: web_search_20250305 · web_search_20260209

namestringrequired

Value: "web_search"

max_usesintegeroptional

Default: 1

Minimum: 1

Maximum: 5

allowed_domainsarray | nulloptional
ساختار داخلی
قالب 1

Array

قالب 2

null

blocked_domainsarray | nulloptional
ساختار داخلی
قالب 1

Array

قالب 2

null

user_locationobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "approximate"

citystringoptional

Maximum length: 200

regionstringoptional

Maximum length: 200

countrystringoptional

Minimum length: 2

Maximum length: 2

timezonestringoptional

Maximum length: 100

قالب 2

null

cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 3
typestringrequired

Value: "web_fetch_20250910"

namestringrequired

Value: "web_fetch"

max_usesintegeroptional

Default: 1

Minimum: 1

Maximum: 5

max_content_tokensintegeroptional

Default: 8000

Minimum: 1

Maximum: 32000

allowed_domainsarray | nulloptional
ساختار داخلی
قالب 1

Array

قالب 2

null

blocked_domainsarray | nulloptional
ساختار داخلی
قالب 1

Array

قالب 2

null

citationsobjectoptional
ساختار داخلی
enabledbooleanrequired
cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 4
typestringrequired

Values: computer_20250124 · computer_20251124

namestringrequired

Value: "computer"

display_width_pxintegerrequired

Minimum: 1

Maximum: 8192

display_height_pxintegerrequired

Minimum: 1

Maximum: 8192

display_numberintegeroptional

Minimum: 0

Maximum: 100

enable_zoombooleanoptional
cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 5
قالب 1
typestringrequired

Value: "bash_20250124"

namestringrequired

Value: "bash"

cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 2
typestringrequired

Values: text_editor_20250124 · text_editor_20250728

namestringrequired

Values: str_replace_editor · str_replace_based_edit_tool

cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 6
typestringrequired

Values: openrouter:web_search · openrouter:web_fetch · openrouter:datetime · openrouter:bash

tool_choiceobject | object | objectoptional
ساختار داخلی
قالب 1
typestringrequired

Values: auto · any

disable_parallel_tool_usebooleanoptional
قالب 2
typestringrequired

Value: "tool"

namestringrequired

Maximum length: 100

disable_parallel_tool_usebooleanoptional
قالب 3
typestringrequired

Value: "none"

thinkingobject | object | objectoptional
ساختار داخلی
قالب 1
typestringrequired

Value: "enabled"

budget_tokensintegerrequired

Minimum: 1024

Maximum: 32767

displaystringoptional

Values: summarized · omitted

قالب 2
typestringrequired

Value: "adaptive"

displaystringoptional

Values: summarized · omitted

قالب 3
typestringrequired

Value: "disabled"

cache_controlobjectoptional
ساختار داخلی
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

stop_sequencesarrayoptional

Maximum items: 20

ساختار داخلی

string

metadataobjectoptional
ساختار داخلی
user_idstring | nulloptional
ساختار داخلی
قالب 1

string

قالب 2

null

output_configobjectoptional
ساختار داخلی
effortstringoptional

Values: low · medium · high · max

formatobjectoptional
ساختار داخلی
typestringrequired

Value: "json_schema"

schemaobjectrequired
پارامترها و هدرها
JSON
[
  {
    "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"
    }
  }
]

نمونهٔ درخواست

Python
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.

idstringrequired
typeobjectrequired

Value: "message"

roleobjectrequired

Value: "assistant"

modelstringrequired
contentarrayrequired
ساختار داخلی
قالب 1
typeobjectrequired

Value: "text"

textstringrequired
قالب 2
typeobjectrequired

Values: tool_use · server_tool_use

idstringrequired
namestringrequired
inputobjectrequired
قالب 3
typeobjectrequired

Values: 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

thinkingstringoptional
signaturestringoptional
datastringoptional
stop_reasonobjectrequired

Values: end_turn · max_tokens · tool_use · stop_sequence · pause_turn · refusal · model_context_window_exceeded

stop_sequencestring | nullrequired
usageobjectrequired
ساختار داخلی
input_tokensintegerrequired

Minimum: 0

output_tokensintegerrequired

Minimum: 0

total_tokensintegeroptional

Minimum: 0

cache_creation_input_tokensintegeroptional

Minimum: 0

cache_read_input_tokensintegeroptional

Minimum: 0

server_tool_useobject | nulloptional
default

Anthropic-shaped error with the Sarovi request ID.

typeobjectrequired

Value: "error"

request_idstringoptional
errorobjectrequired
ساختار داخلی
typestringrequired
messagestringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

modelstringrequired

Minimum length: 1

Maximum length: 200

messagesarrayrequired

Minimum items: 1

Maximum items: 1000

ساختار داخلی
rolestringrequired

Values: user · assistant

contentstring | arrayrequired
ساختار داخلی
قالب 1

string

قالب 2

Array

systemstring | arrayoptional
ساختار داخلی
قالب 1

string

قالب 2

Array

toolsarrayoptional

Maximum items: 128

ساختار داخلی
قالب 1
typestringoptional

Value: "custom"

namestringrequired
descriptionstringoptional

Maximum length: 16000

input_schemaobjectrequired
strictbooleanoptional
cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 2
typestringrequired

Values: web_search_20250305 · web_search_20260209

namestringrequired

Value: "web_search"

max_usesintegeroptional

Default: 1

Minimum: 1

Maximum: 5

allowed_domainsarray | nulloptional
ساختار داخلی
قالب 1

Array

قالب 2

null

blocked_domainsarray | nulloptional
ساختار داخلی
قالب 1

Array

قالب 2

null

user_locationobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "approximate"

citystringoptional

Maximum length: 200

regionstringoptional

Maximum length: 200

countrystringoptional

Minimum length: 2

Maximum length: 2

timezonestringoptional

Maximum length: 100

قالب 2

null

cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 3
typestringrequired

Value: "web_fetch_20250910"

namestringrequired

Value: "web_fetch"

max_usesintegeroptional

Default: 1

Minimum: 1

Maximum: 5

max_content_tokensintegeroptional

Default: 8000

Minimum: 1

Maximum: 32000

allowed_domainsarray | nulloptional
ساختار داخلی
قالب 1

Array

قالب 2

null

blocked_domainsarray | nulloptional
ساختار داخلی
قالب 1

Array

قالب 2

null

citationsobjectoptional
ساختار داخلی
enabledbooleanrequired
cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 4
typestringrequired

Values: computer_20250124 · computer_20251124

namestringrequired

Value: "computer"

display_width_pxintegerrequired

Minimum: 1

Maximum: 8192

display_height_pxintegerrequired

Minimum: 1

Maximum: 8192

display_numberintegeroptional

Minimum: 0

Maximum: 100

enable_zoombooleanoptional
cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 5
قالب 1
typestringrequired

Value: "bash_20250124"

namestringrequired

Value: "bash"

cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 2
typestringrequired

Values: text_editor_20250124 · text_editor_20250728

namestringrequired

Values: str_replace_editor · str_replace_based_edit_tool

cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 6
typestringrequired

Values: openrouter:web_search · openrouter:web_fetch · openrouter:datetime · openrouter:bash

tool_choiceobject | object | objectoptional
ساختار داخلی
قالب 1
typestringrequired

Values: auto · any

disable_parallel_tool_usebooleanoptional
قالب 2
typestringrequired

Value: "tool"

namestringrequired

Maximum length: 100

disable_parallel_tool_usebooleanoptional
قالب 3
typestringrequired

Value: "none"

thinkingobject | object | objectoptional
ساختار داخلی
قالب 1
typestringrequired

Value: "enabled"

budget_tokensintegerrequired

Minimum: 1024

Maximum: 32767

displaystringoptional

Values: summarized · omitted

قالب 2
typestringrequired

Value: "adaptive"

displaystringoptional

Values: summarized · omitted

قالب 3
typestringrequired

Value: "disabled"

output_configobjectoptional
ساختار داخلی
effortstringoptional

Values: low · medium · high · max

formatobjectoptional
ساختار داخلی
typestringrequired

Value: "json_schema"

schemaobjectrequired
پارامترها و هدرها
JSON
[
  {
    "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"
    }
  }
]

نمونهٔ درخواست

Python
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.

typeobjectrequired

Value: "error"

request_idstringoptional
errorobjectrequired
ساختار داخلی
typestringrequired
messagestringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر

بدنهٔ درخواست

requestsarrayrequired

Minimum items: 1

Maximum items: 1000

ساختار داخلی
custom_idstringrequired
paramsobjectrequired
ساختار داخلی
modelstringrequired

Minimum length: 1

Maximum length: 200

max_tokensintegerrequired

Minimum: 1

Maximum: 32768

messagesarrayrequired

Minimum items: 1

Maximum items: 1000

ساختار داخلی
rolestringrequired

Values: user · assistant

contentstring | arrayrequired
ساختار داخلی
قالب 1

string

قالب 2

Array

systemstring | arrayoptional
ساختار داخلی
قالب 1

string

قالب 2

Array

streambooleanoptional

Default: false

temperaturenumberoptional

Minimum: 0

Maximum: 1

top_pnumberoptional

Minimum: 0

Maximum: 1

top_kintegeroptional

Minimum: 0

Maximum: 9007199254740991

toolsarrayoptional

Maximum items: 128

ساختار داخلی
قالب 1
typestringoptional

Value: "custom"

namestringrequired
descriptionstringoptional

Maximum length: 16000

input_schemaobjectrequired
strictbooleanoptional
cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 2
typestringrequired

Values: web_search_20250305 · web_search_20260209

namestringrequired

Value: "web_search"

max_usesintegeroptional

Default: 1

Minimum: 1

Maximum: 5

allowed_domainsarray | nulloptional
ساختار داخلی
قالب 1

Array

قالب 2

null

blocked_domainsarray | nulloptional
ساختار داخلی
قالب 1

Array

قالب 2

null

user_locationobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "approximate"

citystringoptional

Maximum length: 200

regionstringoptional

Maximum length: 200

countrystringoptional

Minimum length: 2

Maximum length: 2

timezonestringoptional

Maximum length: 100

قالب 2

null

cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 3
typestringrequired

Value: "web_fetch_20250910"

namestringrequired

Value: "web_fetch"

max_usesintegeroptional

Default: 1

Minimum: 1

Maximum: 5

max_content_tokensintegeroptional

Default: 8000

Minimum: 1

Maximum: 32000

allowed_domainsarray | nulloptional
ساختار داخلی
قالب 1

Array

قالب 2

null

blocked_domainsarray | nulloptional
ساختار داخلی
قالب 1

Array

قالب 2

null

citationsobjectoptional
ساختار داخلی
enabledbooleanrequired
cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 4
typestringrequired

Values: computer_20250124 · computer_20251124

namestringrequired

Value: "computer"

display_width_pxintegerrequired

Minimum: 1

Maximum: 8192

display_height_pxintegerrequired

Minimum: 1

Maximum: 8192

display_numberintegeroptional

Minimum: 0

Maximum: 100

enable_zoombooleanoptional
cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 5
قالب 1
typestringrequired

Value: "bash_20250124"

namestringrequired

Value: "bash"

cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 2
typestringrequired

Values: text_editor_20250124 · text_editor_20250728

namestringrequired

Values: str_replace_editor · str_replace_based_edit_tool

cache_controlobject | nulloptional
ساختار داخلی
قالب 1
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

قالب 2

null

قالب 6
typestringrequired

Values: openrouter:web_search · openrouter:web_fetch · openrouter:datetime · openrouter:bash

tool_choiceobject | object | objectoptional
ساختار داخلی
قالب 1
typestringrequired

Values: auto · any

disable_parallel_tool_usebooleanoptional
قالب 2
typestringrequired

Value: "tool"

namestringrequired

Maximum length: 100

disable_parallel_tool_usebooleanoptional
قالب 3
typestringrequired

Value: "none"

thinkingobject | object | objectoptional
ساختار داخلی
قالب 1
typestringrequired

Value: "enabled"

budget_tokensintegerrequired

Minimum: 1024

Maximum: 32767

displaystringoptional

Values: summarized · omitted

قالب 2
typestringrequired

Value: "adaptive"

displaystringoptional

Values: summarized · omitted

قالب 3
typestringrequired

Value: "disabled"

cache_controlobjectoptional
ساختار داخلی
typestringrequired

Value: "ephemeral"

ttlstringoptional

Values: 5m · 1h

stop_sequencesarrayoptional

Maximum items: 20

ساختار داخلی

string

metadataobjectoptional
ساختار داخلی
user_idstring | nulloptional
ساختار داخلی
قالب 1

string

قالب 2

null

output_configobjectoptional
ساختار داخلی
effortstringoptional

Values: low · medium · high · max

formatobjectoptional
ساختار داخلی
typestringrequired

Value: "json_schema"

schemaobjectrequired
پارامترها و هدرها
JSON
[
  {
    "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"
    }
  }
]

نمونهٔ درخواست

Python
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.

typeobjectrequired

Value: "error"

request_idstringoptional
errorobjectrequired
ساختار داخلی
typestringrequired
messagestringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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"
    }
  }
]

نمونهٔ درخواست

Python
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.

typeobjectrequired

Value: "error"

request_idstringoptional
errorobjectrequired
ساختار داخلی
typestringrequired
messagestringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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"
    }
  }
]

نمونهٔ درخواست

Python
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.

typeobjectrequired

Value: "error"

request_idstringoptional
errorobjectrequired
ساختار داخلی
typestringrequired
messagestringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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"
    }
  }
]

نمونهٔ درخواست

Python
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.

typeobjectrequired

Value: "error"

request_idstringoptional
errorobjectrequired
ساختار داخلی
typestringrequired
messagestringrequired
قرارداد کامل OpenAPI
JSON
{
  "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.

پیوند این مسیر
پارامترها و هدرها
JSON
[
  {
    "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"
    }
  }
]

نمونهٔ درخواست

Python
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.

typeobjectrequired

Value: "error"

request_idstringoptional
errorobjectrequired
ساختار داخلی
typestringrequired
messagestringrequired
قرارداد کامل OpenAPI
JSON
{
  "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 · تاریخچهٔ تغییرات