HTTP Request

Make an HTTP request to a public URL and get the status, headers and body back. JSON, form, text and multipart file uploads; internal addresses are refused.

run with your agent
# install belt
$curl -fsSL https://cli.inference.sh | sh
# sign in (or set INFERENCE_API_KEY on a headless machine)
$belt login
# view schema & details
$belt app get infsh/http
# run
$belt app run infsh/http --input '{"url":"url"}'
maker
infsh
category
other
price
from $0.00000277/sec
runs via
api, javascript and python sdk, belt cli, mcp
updated
2026-10-11

api reference

about

make an http request to a public url and get the status, headers and body back. json, form, text and multipart file uploads; internal addresses are refused.

1. calling the api

install the client

the client provides a convenient way to interact with the api.

bash
1pip install inferencesh

setup your api key

set INFERENCE_API_KEY as an environment variable. get your key from settings → api keys.

bash
1export INFERENCE_API_KEY="inf_your_key"

run and get result

submit a request and wait for the final result. best for batch processing or when you don't need progress updates.

python
1import os2from inferencesh import inference34client = inference(api_key=os.environ["INFERENCE_API_KEY"])567result = client.run({8        "app": "infsh/http",9        "input": {10            "url": "url"11        }12    })1314print(result["output"])

stream live updates

get real-time progress updates as the task runs. ideal for showing progress bars, partial results, or long-running tasks.

python
1import os2from inferencesh import inference34client = inference(api_key=os.environ["INFERENCE_API_KEY"])567# stream=True yields updates as they arrive8for update in client.run({9        "app": "infsh/http",10        "input": {11            "url": "url"12        }13    }, stream=True):14    if update.get("progress"):15        print(f"progress: {update['progress']}%")16    if update.get("output"):17        print(f"output: {update['output']}")

2. authentication

the api uses api keys for authentication. see the authentication docs for detailed setup instructions.

3. files

file inputs are automatically handled by the sdk. you can pass local paths, urls, or base64 data.

automatic upload

the python sdk automatically detects local file paths and uploads them. urls are passed through as-is.

python
1# local file paths are automatically uploaded2result = client.run({3    "app": "infsh/http",4    "input": {5        "image": "/path/to/local/image.png",  # detected & uploaded6        "audio": "https://example.com/audio.mp3",  # url passed through7    }8})

manual upload

you can also upload files manually and use the returned url.

python
1# upload and get a hosted URL2file = client.files.upload("/path/to/file.png")3print(file.uri)  # https://cloud.inference.sh/...

4. webhooks

get notified when a task completes by providing a webhook url. when the task reaches a terminal state (completed, failed, or cancelled), a POST request is sent to your url with the task result.

python
1result = client.run({2    "app": "infsh/http",3    "input": {4        "url": "url"5    },6    "webhook": "https://your-server.com/webhook"7}, wait=False)

webhook payload

your endpoint receives a JSON POST with the task result:

json
1{2  "event": "task.completed",3  "timestamp": "2024-01-15T10:30:05Z",4  "data": {5    "id": "task_abc123",6    "short_id": "abc123",7    "status": 10,8    "status_text": "completed",9    "output": { ... },10    "created_at": "2024-01-15T10:30:00Z",11    "updated_at": "2024-01-15T10:30:05Z"12  }13}
eventstringtask.completed, task.failed or task.cancelled
timestampstringiso timestamp of the delivery
data.idstringtask id
data.short_idstringshort task id
data.statusnumberterminal status (10=completed, 11=failed, 12=cancelled)
data.status_textstringthe status as a word: completed, failed or cancelled
data.outputobjecttask output (when completed)
data.errorstringerror message (when failed, omitted otherwise)
data.session_idstringsession id (when the task ran in a session, omitted otherwise)
data.created_atstringiso timestamp
data.updated_atstringiso timestamp

5. schema

input

methodstring

http method.

default: "GET"
options:"GET""POST""PUT""PATCH""DELETE""HEAD""OPTIONS"
urlstring*

request url. http or https only; must resolve to a public internet address.

headersobject

request headers. connection-level headers (host, content-length, connection, transfer-encoding, ...) are dropped.

queryobject

query parameters, added to any already in the url. a list repeats the key.

body_jsonany

json request body (any json value). sets content-type: application/json.

body_textstring

raw text request body. set content-type in headers (default text/plain; charset=utf-8).

formobject

form fields. sent application/x-www-form-urlencoded, or as multipart fields when files are given.

filesarray

files to upload as multipart/form-data, optionally with form fields.

timeout_secondsnumber

deadline for the whole request: connect, redirects and reading the body.

default: 30max:120
follow_redirectsboolean

follow 3xx redirects. each hop is checked like the first.

default: true
max_redirectsinteger

most redirects to follow.

default: 10min:0max:10
max_response_bytesinteger

largest response body to read (decoded bytes).

default: 10485760min:1max:104857600
truncateboolean

when the body exceeds max_response_bytes: true returns the first max_response_bytes with truncated=true, false fails the task.

default: false
response_asstring

auto: json to body_json, small text to body_text, anything else to body_file. json/text/file force one.

default: "auto"
options:"auto""json""text""file"

output

body_filestring(file)

body as a file, when binary, large, or response_as=file.

body_jsonany

parsed body, when it is json.

body_textstring

body as text, when it is text.

elapsed_msinteger*

time inside the app from sending the request to the end of the body.

final_urlstring*

url of the final response, after redirects.

headersobject*

response headers, lower-case names; repeated headers joined with ', '.

okboolean*

true when status is 2xx.

redirectsinteger

redirects followed.

size_bytesinteger

body bytes read (after content decoding).

statusinteger*

http status code of the final response.

truncatedboolean

true when the body was cut at max_response_bytes.

ready to run HTTP Request?

we use cookies

we use cookies to ensure you get the best experience on our website. for more information on how we use cookies, please see our cookie policy.

by clicking "accept", you agree to our use of cookies.
learn more.