curl --request POST \
--url https://api.seltz.ai/v1/fetch \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"urls": [
"https://example.com/"
]
}
'import requests
url = "https://api.seltz.ai/v1/fetch"
payload = { "urls": ["https://example.com/"] }
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({urls: ['https://example.com/']})
};
fetch('https://api.seltz.ai/v1/fetch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.seltz.ai/v1/fetch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'urls' => [
'https://example.com/'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.seltz.ai/v1/fetch"
payload := strings.NewReader("{\n \"urls\": [\n \"https://example.com/\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.seltz.ai/v1/fetch")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"urls\": [\n \"https://example.com/\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.seltz.ai/v1/fetch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"urls\": [\n \"https://example.com/\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": []
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Fetch
curl --request POST \
--url https://api.seltz.ai/v1/fetch \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"urls": [
"https://example.com/"
]
}
'import requests
url = "https://api.seltz.ai/v1/fetch"
payload = { "urls": ["https://example.com/"] }
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({urls: ['https://example.com/']})
};
fetch('https://api.seltz.ai/v1/fetch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.seltz.ai/v1/fetch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'urls' => [
'https://example.com/'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.seltz.ai/v1/fetch"
payload := strings.NewReader("{\n \"urls\": [\n \"https://example.com/\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.seltz.ai/v1/fetch")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"urls\": [\n \"https://example.com/\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.seltz.ai/v1/fetch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"urls\": [\n \"https://example.com/\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": []
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Headers
Seltz API key: https://console.seltz.ai/api-keys
Body
Fetch request.
API key to access the service. Either this or the x-api-key header must
be supplied on the HTTP surface; the header takes precedence and is the
documented path. On gRPC this field is the only carrier.
Representations to return, as documented format names.
Omitted, or sent empty, means \["markdown"\] -- a repeated field carries
no presence, so the two are the same request and neither means "no
formats".
Documented names:
"markdown" -- the main content as Markdown, boilerplate removed.
An unrecognized name is rejected. Silently dropping it would return a body missing the representation the caller asked for, with nothing to signal why.
The service tier, which selects the price. Send "pro". Unset resolves to
"pro".
An unrecognized value is rejected rather than defaulted: the value selects a price, and quietly billing a tier the caller did not name is worse than refusing.
Wall-clock budget for one URL, in milliseconds.
Applies per URL, not to the batch: URLs are fetched concurrently, so a
batch takes roughly as long as its slowest entry rather than the sum. A
URL that exceeds the budget gets error.code = "timeout"; the others in
the same request are unaffected.
Unset means the service default. Values are clamped to the service maximum.
x >= 0The URLs to fetch. At least one, at most 20.
Each must be an absolute http or https URL of at most 2048 bytes. An
empty list, more than 20 entries, a duplicate entry, or an over-long entry
is rejected before any billing: duplicates because
FetchResult.requested_url is the correlation key and a repeated key is
ambiguous. A URL that parses but cannot be fetched -- a host that does not
resolve, an origin that refuses, a document that is not an HTML page -- is
reported inside a 200 as that URL's error result, not as a rejection.
Response
One result per requested URL. A failure to fetch a page is still a 200, with that result's status = "error".
Fetch response -- one result per requested URL.
One entry per entry in FetchRequest.urls, successful or not, in the order
the URLs were requested.
Correlate on FetchResult.requested_url rather than on position. That is
the key a duplicate URL would make ambiguous, which is why the request
rejects one.
Show child attributes
Show child attributes