---
title: Connections reference
slug: connections-reference
summary: Look up every Connection command, flag, limit and rule, from setup contracts and OAuth to rotation, calls, files, secrets and tests.
---

# Connections reference

This is the complete reference. For a short guide, start with [Connections](./connections.md).

A **Connection** is a reusable routing and authentication handle granted to a workspace. Its credential values are stored separately in the encrypted credential vault. Function code and the CLI reach the provider through the egress gateway, which enforces the Connection definition and injects credentials server-side. The raw credential is never handed to the caller.

## In function code

```python
from limilake import connections

# GET/POST/request/paginate proxy through the egress gateway.
resp = connections.get("stripe", "/v1/charges", params={"limit": 10})
data = resp.json()

# paginate() follows the provider's paging. You describe it once: where the
# records are in a response, and where the next cursor is.
for page in connections.paginate(
    "zendesk",
    "/api/v2/tickets",
    paginate={
        "type": "cursor",
        "response_path": "tickets",
        "cursor_path_in_response": "meta.after_cursor",
        "cursor_name_in_request": "page[after]",
        "limit_name_in_request": "page[size]",
        "limit": 100,
    },
):
    ...
```

The ref you pass is the connection's **slug** (shown by `list_connections` and in the UI). It is matched against the grants your workspace holds, and the credential is injected at the gateway on each call. OAuth connections are refreshed at the gateway automatically.

## Revealing material

Connections are call-through only: the gateway injects the credential and your code never holds it. To read raw credential material directly instead (a database password, a raw API key, anything non-HTTP), use a **Secret** and `secrets.reveal("ref")`, which returns the material, gated, and only for revealable refs. A connection that explicitly opted into reveal can also be read this way.

Calling a Connection through the gateway needs `viewer` access or higher in the Workspace. Revealing raw material needs `editor` or `owner`, and a scoped credential also needs the `egress.reveal` scope.

Create a Secret from private JSON input, supplying the Workspace explicitly:

```bash
limilake secret create partner-db --workspace finance --values-from - \
  --no-input < private-secret.json
limilake secret create partner-db --workspace finance \
  --values-from @private-secret.json
```

The file contains one JSON object of string values, for example password and
username fields. Creation returns only field keys; the CLI has no reveal verb.

## Discover setup requirements

The server owns one Setup Contract for every catalog provider and Custom
Connection authentication profile. The portal, CLI, managed Agent, and external
automation consume the same stable requirement keys and validation rules.

```bash
limilake connection provider list
limilake connection provider show stripe
limilake --output json connection provider show stripe
```

The contract describes required fields, secret classification, choices,
recommended and known OAuth scopes, possible next actions, and safe
capabilities. It never contains submitted or stored values.

Provider IDs use the catalog's exact spelling, for example `aws-s3`. A misspelled
ID on `connection provider show` suggests a close live catalog ID
when unambiguous, while retaining failure. The CLI never substitutes or retries
the suggested provider automatically.

## Create a Connection

An interactive human can submit known non-sensitive values and let the CLI hide
any missing secret prompt:

```bash
limilake connection create --provider wint --workspace finance \
  --field username=11810
```

Direct values remain supported, but command-line arguments may be retained in
shell history or visible in process listings. Prefer structured standard input
or a protected file for secrets:

```bash
printf '%s' '{"username":"11810","password":"..."}' | \
  limilake --output json connection create \
    --provider wint --workspace finance --values-from -
```

Both `connection create` and `secret create` accept `--values-from -` or `@file`,
bounded to 1 MiB. The input must be one UTF-8 JSON object of strings with
unique, non-blank keys and no surrounding key whitespace. Nulls, arrays,
numbers, duplicate keys, extra JSON documents, keys overlapping `--field` and a
`--field` key given twice fail before mutation. Distinct fields combine. Errors
never echo values.

Stdin or a private file keeps secret values out of process arguments.
`--no-input` suppresses prompts and still permits explicitly requested stdin.

This is also the external-Agent flow: inspect the JSON contract, ask the human
only for missing requirements, submit values through standard input, and retain
the returned stable Connection ref. Agents are not required to author provider
YAML.

Initial OAuth begins with the same `create` command. The CLI opens the browser
unless `--no-browser` is set, then waits for the server-owned callback:

```bash
limilake connection create --provider fortnox --workspace finance \
  --scope invoice --scope supplier --timeout 5m

limilake connection create --provider fortnox --workspace finance \
  --no-browser --timeout 10m
```

After you approve access, the browser shows a LimiLake page that confirms the
connection and normally names the Tenant, Workspace, and Connection ref you
authorized, for example
`Fortnox connected to Acme / Finance (connection fortnox).` It never switches
the Tenant your browser has selected. Close the tab and return to your
terminal; the CLI prints a matching line that names the Tenant from your
profile. If the provider declines or the link has expired, the page says why;
run the command again from your terminal. Opening a link that was already used,
for example by refreshing the page, says so without reporting a failure.

Known scopes are recommendations, not a hard allowlist. Sanitized custom scope
strings can be requested; the upstream provider makes the final decision.
Replace a revoked grant or request changed scopes without changing the stable
Connection ref:

```bash
limilake connection reauthorize fortnox --workspace finance \
  --scope invoice --scope custom.scope
```

Create a bounded Custom Connection without a YAML specification:

```bash
printf '%s' '{"api_key":"..."}' | \
  limilake connection create --custom --name partner-api --workspace finance \
    --base-url https://api.partner.example/v1 \
    --allowed-host api.partner.example \
    --auth-method api_key --inject-header X-API-Key \
    --values-from -
```

Custom routing still passes server validation: HTTPS only, explicit safe hosts,
reviewed authentication profiles, and declarative header/query injection. Raw
reveal-only material belongs under `limilake secret`, not a Custom Connection.

## Rotate static credentials or update routing

Rotate an S3 secret in place by piping one JSON object into the update command:

```bash
limilake connection update enreach_s3 --workspace finance --values-from - \
  < private-rotation.json
```

The JSON object contains only the fields being changed, such as
`secret_access_key`. Keep secret values out of shell arguments and history.
These update verbs accept stdin only; `--values-from @file` is refused.
For a catalog Zendesk Connection using Basic authentication,
`limilake connection update helpdesk --field subdomain=acme-support` updates
Setup Contract-declared non-secret metadata.
Plain vault types do not classify secret fields; all their config keys, including
region/host, require stdin values. Display names use `--name`.

Update a custom API endpoint and replace its complete allowed-host set:

```bash
limilake connection update partner-api --workspace finance \
  --base-url https://api.partner.example/v2 \
  --allowed-host api.partner.example --inject-header X-API-Key
limilake credential update storage --workspace finance --name 'Finance storage'
```

Omitted fields remain unchanged. Catalog-owned routing cannot be overridden.
Both updates need a Workspace: `--workspace`, its environment fallback, or the
linked checkout. A direct Credential update names a Workspace the credential is
granted to, and needs `editor` access in every Workspace it is granted to. A
grant to a deleted Workspace does not count: it gives nobody access until a
tenant administrator restores that Workspace, and then it counts again.
Conflicting Workspace environment defaults require an explicit
`--workspace`. Shared updates may affect several Workspace grants.
The result reports `affected_grants`. Both preserve the credential ID and every
stable Workspace ref and grant. OAuth credentials continue to use `reauthorize`.

Concurrent changes are rejected with retry advice; the CLI never repeats a secret
write automatically. JSON/YAML results contain only identity, display name,
revision and grant scope. Successful deletion releases the Workspace ref, so
recreation with the same explicit `--ref` works without choosing another name.

## Inspect, test, call, and delete

```bash
limilake connection list
limilake connection show stripe
limilake connection test stripe
limilake connection call stripe --method GET --path /v1/charges \
  --query limit=10
limilake connection call stripe --method POST --path /v1/refunds \
  --input @refund.json --output-file response.json
limilake connection delete stripe --yes
```

Keep query strings out of `--path`. Supply each decoded key/value through a
separate `--query`; the CLI encodes it for transport. Quote shell metacharacters:

```bash
limilake connection call graph --method GET --path /users \
  --query '$top=1' --query '$select=id,displayName'
```

A full `--path '/users?$top=1'` returns a recovery example. Remove any `#fragment`;
fragments are never sent to a provider. Error hints omit the supplied query and
fragment values.

`show` includes the definition, Setup Contract, lifecycle state, next action,
safe capabilities, and granted OAuth scopes. `test` sends bounded, read-only
authenticated provider probes; see [Test authentication](#test-authentication).
`call` requires an explicit method and upstream-relative path; absolute URLs,
credential headers, and oversized input/output are rejected. For each call the
CLI exchanges its profile credential for a five-minute token bound to the
verified tenant user, identity, and one workspace. That token is never printed
or persisted. The egress gateway remains the enforcement and audit boundary for
SSRF, credential injection, rate limits, and the selected Connection ref.

## Send files

`call` sends one body: JSON through `--input`, a `multipart/form-data` form
through `--file` and `--field`, or a file's raw bytes through `--body-file`.
File bodies stream from disk instead of being loaded into memory, and use the
same Connection authentication, Workspace selection, and audit as JSON calls.

`--file [FIELD=]PATH` adds one file part; the field name defaults to `file`,
and the part's file name is the path's last element. Repeat it to send several
files in one form, and add text fields with `--field name=value`. A path whose
text before `=` is a plain field name is read as `FIELD=PATH`; write `./a=b.pdf`
to send a file named `a=b.pdf`. Each part's `Content-Type` follows its
extension, such as `application/pdf` for `.pdf`. `--body-file PATH` sends the
file unchanged as the whole body, typed by `--content-type` (default
`application/octet-stream`). A file body sets its own `Content-Type`, so do not
also pass one with `--header`.

Every body, including the multipart framing, is bounded by `--max-bytes`
(10 MiB by default). A larger file, a file that is not a regular file, or a
missing file fails before any request is sent. Raise `--max-bytes` only within
what the provider itself accepts.

For example, attach a PDF to a Fortnox customer invoice in two calls: upload it
to the Fortnox inbox, then link the returned file `Id` to the invoice.

```bash
limilake connection call fortnox --workspace finance --method POST \
  --path /3/inbox --file invoice-1001.pdf --fail
limilake connection call fortnox --workspace finance --method POST \
  --path /api/fileattachments/attachments-v1 --input @attach.json --fail
```

`attach.json` follows Fortnox's Attachments API: it names the uploaded file's
`Id` and the customer invoice it belongs to.

In function code, pass `files=` for a multipart body or `content=` for raw
bytes; open files stream rather than being read into memory:

```python
from limilake import connections

with open("invoice-1001.pdf", "rb") as pdf:
    resp = connections.post(
        "fortnox", "/3/inbox",
        files={"file": ("invoice-1001.pdf", pdf, "application/pdf")},
    )
```

The access audit records each upload's size and SHA-256, and for a multipart
body each file part's field name, file name, content type, size and SHA-256.
It never records file contents or text field values.

## Why no raw secrets in the sandbox

The sandbox or short-lived CLI call token carries authority, not provider
credentials. Injecting credentials server-side, per call, keeps secret material
off untrusted machines and out of execution logs; the same boundary applies in a
live sandbox, local function runtime, and external CLI.


## Test authentication

```bash
limilake connection test enreach_s3 --workspace finance --bucket finance-data
limilake connection test graph --workspace finance --output json
limilake connection call graph --workspace finance --method GET --path /v1.0/me --fail
```

`connection test` sends bounded, read-only requests through the normal
Connection authorization path. S3 lists at most one object in the specified bucket. Graph
checks metadata for connectivity, then a read compatible with the stored
permission hints. Metadata alone does not verify authentication. A Connection
is `connected: true` only after a fresh successful authenticated request.

The report includes configuration, nullable `auth_verified` and `healthy` values,
probe HTTP statuses, timings, and remedies. It omits provider response bodies and
credentials. Unsupported providers or permission sets remain unknown. The
30-second default budget includes discovery, token acquisition, and all probes;
use `--timeout` to select another budget. Exit 0 means healthy, 1 means a failed
probe, 2 means missing bucket input, and 9 means authentication health is unknown.
Authority or discovery failures keep their normal error codes.

`connection call --fail` exits 1 for non-2xx responses while keeping the
response content. Without it, HTTP failures exit 0.
