Read a web page
Read one public web page and get its text.
POST
https://inference.trymorse.ai/v1/fetchReads one public web page and returns its text. Each call costs 1,000 micros, a tenth of a credit. A failed call costs nothing.
Page reading is not offered to API keys for now: GET /v1/models lists no such model to a key, and a key's request here gets 404 model_not_found. A Morse app login can still use it.
curl -X POST https://inference.trymorse.ai/v1/fetch \
-H "Authorization: Bearer $MORSE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "parallel-extract",
"url": "https://go.dev/doc/go1.27"
}'{
"object": "fetch.result",
"url": "https://go.dev/doc/go1.27",
"title": "Go 1.27 Release Notes",
"published": null,
"content": "# Go 1.27 Release Notes\n...",
"truncated": true
}Request body
modelstringRequiredA fetch model's id, such as parallel-extract.
urlstringRequiredAn http or https URL on a public host and the default port, 80 or 443, without credentials. The fragment is dropped.
Response
The result.
object"fetch.result"RequiredurlstringRequiredtitlestring | nullRequiredpublishedstring | nullRequiredYYYY-MM-DD, or null when unknown.
contentstringRequiredThe page's text, often Markdown, at most 12,000 characters.
truncatedbooleanRequiredWhether the content was cut at 12,000 characters.
Response headers
| Header | What it says |
|---|---|
X-Morse-Version | The running build. Every reply carries it. |
X-Funding | What pays for the request. With a key, the value is always credits. A request that Morse refuses before it bills anything has no X-Funding. |
X-Request-Id | An id for this request. Quote it when you contact support about the request. An error that arrives after the request starts carries it too. A request that Morse refuses before it bills anything has no X-Request-Id. |
Errors
Every error has the same shape. Errors explains it and when to retry.
400The request is malformed.5 codes
invalid_request_body- The body is not a JSON object, a field has the wrong JSON type, or model is missing.
invalid_parameter- A field has a value the endpoint refuses. The message names the field.
duplicate_json_key- A JSON object in the body repeats a key.
invalid_url- url is missing, or not an http or https URL of at most 2,048 characters on a public host and the default port.
privacy_floor_unmet- The model's tier is below the API key's min_privacy. param is key.min_privacy, and the message names both tiers. GET /v1/models lists only the models the key may call. Morse refuses before it calls the model or holds any credit.
401The key is missing or wrong.3 codes
invalid_api_key- The Authorization header is missing or not Bearer, the key is unknown or revoked, a token that starts with sk_ is not a whole sk_morse_ key, or the bearer is no Morse key or login token at all, such as another service's API key (sk-proj-...).
api_key_expired- The key is past the expiry set on it. Make a new key, or set a later expiry before a key expires.
invalid_token- The bearer is shaped as a Morse login token (a JWT) but its signature fails or it has expired. An API key sends the whole sk_morse_ key.
402The account's credits, or what the key's spend limit has left, do not cover the request.2 codes
insufficient_balance- The balance is below the amount the request must hold. While the balance is negative, the API refuses every metered request.
key_spend_limit_reached- What the key's spend limit has left in its window is below the amount the request must hold. A limit that resets daily, weekly, or monthly sends Retry-After, the seconds until it resets. A limit that never resets sends none. Raise or remove the limit in the dashboard, and the next request is served.
403The key's account may not make this request.5 codes
account_disabled- Morse has disabled the key's account.
account_deleted- The key's account has been deleted.
account_under_18- The account's owner said they are under 18.
ip_not_allowed- The key allows requests only from its allowed IPs, and the request came from another address. The message names the address the proxy saw.
sealed_required- The key is sealed_only, and the request came unsealed. Send it inside POST /v1/sealed, as the Morse app does.
404The model does not exist, or it is not a model for this endpoint.1 code
model_not_found- No model of this endpoint's type has that name.
408The request body arrived too slowly.1 code
request_timeout- The request body did not arrive within one minute.
413The request body is too large.1 code
request_too_large- The body is over 64 KiB.
422Morse could not read the page. The call costs nothing.1 code
fetch_failed- The provider returned no content for the page.
429The account is over its rate limit or its concurrency limit. Search and fetch each also allow 30 calls a minute per account. Wait the number of seconds in Retry-After, then retry.2 codes
rate_limit_exceeded- The account used up its requests per minute. All of the account's keys and its owner's use of the Morse app share one budget.
concurrency_limit_exceeded- The account already has its maximum number of requests in flight. Retry-After is 1.
502The web provider failed.2 codes
upstream_error- The provider failed or did not answer in time.
upstream_unavailable- The provider is unavailable right now. Retry later, or choose another model.
503Morse or the provider is busy or unavailable. Retry the request later.3 codes
service_unavailable- Morse could not start the request. Retry it.
server_busy- Morse is busy. Retry-After is 1.
upstream_busy- The web provider is busy for every Morse account. Retry-After says when to retry.