Skip to main content
POST
/
gen-ai
Generate Script from Prompt
curl --request POST \
  --url https://api.altostrat.io/gen-ai \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "prompt": "Create a firewall rule to block all incoming traffic on port 22 from the internet."
}'
{
  "response": [
    {
      "content": "/ip firewall filter add action=drop chain=input in-interface=ether1 protocol=tcp dst-port=22;",
      "error": null,
      "destructive": true
    }
  ],
  "tokenUsage": {
    "prompt": 75,
    "completion": 30,
    "total": 105
  },
  "response_id": "cmpl-8fV3x5m7y6z4w3v2u1t0s"
}

Authorizations

Authorization
string
header
required

Altostrat SDX API uses JWT Bearer tokens for authentication. Obtain a token via the Authentication API and include it in the Authorization header as 'Bearer {token}'.

Body

application/json
prompt
string
required

The natural language prompt describing the desired script.

Maximum length: 200
Example:

"Create a firewall rule to block all incoming traffic on port 22 from the internet."

Response

The AI-generated script and analysis.

response
object[]
tokenUsage
object
response_id
string
Example:

"cmpl-8fV3x5m7y6z4w3v2u1t0s"