Docs
GuidesWebsite GitHub
OverviewGetting StartedTry the Demo DatabaseApprove a Database WriteTerminal and CLIBackground Host
AgentConversationsConfigurationAuthenticationLLM ProvidersToolsPython Analysis
Data SourcesSQLitePostgreSQLFiles and FoldersHTTP APIsQueryingCatalogDatabase WritesRemote MCP ToolsPrivate Database
Work BoardArtifactsJobsRoutines
Memory and LearningSemanticsSkills
Observation EventsError HandlingEvaluation
Daita / Docs
OverviewGetting StartedTry the Demo DatabaseApprove a Database WriteTerminal and CLIBackground Host
AgentConversationsConfigurationAuthenticationLLM ProvidersToolsPython Analysis
Data SourcesSQLitePostgreSQLFiles and FoldersHTTP APIsQueryingCatalogDatabase WritesRemote MCP ToolsPrivate Database
Work BoardArtifactsJobsRoutines
Memory and LearningSemanticsSkills
Observation EventsError HandlingEvaluation

Daita Agents · Guide

HTTP API

Let the agent pull data from a web API you declare. Responses are saved as files it can query.

An HTTP API source lets the agent fetch from a web API and query what comes back. You declare which host it may reach. The agent chooses the path, the query values and a JSON body.

Each response is saved as a data file, with a receipt beside it, in a folder Daita manages for the source. Detaching the source deletes that folder. The agent reads the files with data_query, file_read and file_search, and the catalog lists them like an attached folder. Nothing lands in your own files or artifacts unless you or the agent saves it.

#Attach an API

python
from daita import HttpSource
 
source = await agent.attach(
    HttpSource(
        "https://api.usaspending.gov/api/v2",
        name="USAspending",
        post_paths=("/bulk_download/awards/",),
        download_hosts=("files.usaspending.gov",),
    )
)
bash
daita attach atlas http \
  --url https://api.usaspending.gov/api/v2 \
  --post-path /bulk_download/awards/ \
  --download-host files.usaspending.gov \
  --source-name USAspending

In the terminal app, type /source add and choose HTTP API.

#API keys

Store the key in your keychain or an environment variable, and give Daita a reference. Daita saves only the reference.

python
from daita import HttpAuth, HttpSource
from daita.security import SecretReference
 
HttpSource(
    "https://api.example.com/v1",
    credential=SecretReference.keychain("example-api"),
    auth=HttpAuth.HEADER,
    auth_name="X-Api-Key",
)
bash
daita attach atlas http --url https://api.example.com/v1 \
  --auth header --auth-name X-Api-Key --secret-ref keychain:example-api

auth is bearer (an Authorization: Bearer header), header (the header named by auth_name) or query (the query parameter named by auth_name). The background host does not see your shell environment, so prefer a keychain reference there. The terminal app stores a pasted key in your keychain for you.

#What you declare

SettingMeaning
base_urlAn https URL. Plain http is allowed only for localhost. Requests stay under its path
post_pathsPaths that may take a POST. Declare only endpoints whose POST reads, such as a search or an export request
download_hostsOther hosts where the API links files. GET only, and they never get the credential
requests_per_minutePacing, 1 to 600. Default 60
sensitivityHow sensitive the responses are. Default internal
maximum_outbound_sensitivityThe most sensitive conversation data a request may come from. Default internal
folderPython only. Your own absolute folder for responses, outside Daita's state. It is kept on detach

#What the agent does

The agent uses one tool, api_fetch:

ArgumentUse
path or urlA path under base_url, or a link the API returned, such as a next page or a file
method and bodyGET (default), or POST to a declared path with a JSON body
queryQuery values
records_pathA JSON pointer such as /results. Also saves those records as NDJSON so data_query can read them as rows
save_asA file name, when the default does not suit
wait_secondsUp to 60, to wait before polling a job

Each result reports the status, content type, saved files with size and SHA-256, and an outline of the JSON keys. Pages are separate fetches. A path_pattern such as awards/*.ndjson queries them together. Supported responses are CSV, TSV, JSON, NDJSON, Parquet and ZIP. A ZIP is kept and its data files are extracted. Anything else, such as an HTML page, is refused and not saved.

The .fetch receipt records the URL without any credential, the method, the body hash, the status and the hash of each file.

#Limits

LimitValue
One response256 MiB
ZIP extraction1 GiB and 200 data files
JSON read for records_path64 MiB
Request body64 KiB
One fetch, including waits and redirects5 minutes
Redirects5, each checked against declared hosts

A folder query reads at most 256 MiB. For bigger data, load it into a database and attach that.

#Safety

  • A request to any other host, or a POST to an undeclared path, is refused before anything is sent. A redirect to an undeclared host is refused, and a redirected POST is never resent.
  • The credential goes only to the base host. It never appears in results, receipts or transcripts.
  • If the conversation holds data more sensitive than maximum_outbound_sensitivity, api_fetch refuses. Fetch in a separate conversation, or raise the limit if the API may see that data.
  • Responses are untrusted. Instructions inside them grant nothing.
  • A run must be able to read the whole source to fetch, because a fetch adds files.

Scheduled routines and jobs can fetch within the same limits, for example to check an API on a schedule.

#Or just ask

You do not have to attach an API first.

A public API with no key. Name it in your request: "using the USAspending API at https://api.usaspending.gov/api/v2, list the top-tier agencies". The agent reads it with api_fetch in that turn. The first request to each host shows an approval card, and approving covers further requests to that host for the rest of the request. Nothing is attached or saved. Responses come back as text, 16 KiB at a time. Only https URLs without keys are allowed.

An API with a key. Describe it: "use the awards API at https://api.example.com/v1, the key goes in the X-Api-Key header". The agent declares it with source_connect, and you get one approval card showing the base URL, how the key is sent and any POST paths or download hosts. The card asks for the key in a private field, and it goes straight to your keychain. The model never sees it. You can instead name an environment variable that holds the key.

After you approve, the agent ends that turn and runs your request again in a follow-up turn that can use the new source. PostgreSQL connects the same way, and the card asks for the password.

If you paste a key into the chat, it has already reached the model. Rotate it.

Only runs you start can connect a source or fetch a URL without one. Routines and jobs cannot.

Related: Data Sources, Querying, Files and Folders.

PreviousFiles and Folders
NextQuerying

On this page

Attach an APIAPI keysWhat you declareWhat the agent doesLimitsSafetyOr just ask