Base URL and default headers
An app (official or custom) can carry three request settings that every connection made from it inherits:
| Setting | Example | Effect |
|---|---|---|
| Base URL | https://api.github.com | Relative URLs in the HTTP Request block are resolved against it. |
| Default headers | Accept: application/vnd.github+json | Added to every request made with the connection, unless the request sets the same header. |
| Test request | GET /user | What Test connection calls (GET, HEAD or POST). May be relative to the base URL. |
Official apps come with these set: GitHub uses https://api.github.com, Stripe https://api.stripe.com, and so
on. For your own API, set them on a custom app. The generic Any REST API templates
have no base URL, so their connections only work with absolute URLs.
Relative URLs in the HTTP Request block
When you choose Use Connection in an HTTP Request node and the connection's app has a base URL, the URL field shows the base URL as a fixed, non-editable prefix. Type only the path:
| Base URL (prefix) | You type | Request goes to |
|---|---|---|
https://api.github.com | /repos/acme/website/issues | https://api.github.com/repos/acme/website/issues |
https://api.example.com/v1 | /users?active=true | https://api.example.com/v1/users?active=true |
https://api.example.com/v1 | users | https://api.example.com/v1/users |
https://api.example.com/v1 | https://status.example.com/health | https://status.example.com/health (absolute URLs are used as is) |
Rules:
- A URL is relative when it has no scheme (
https://). A leading/is optional, and it does not drop the base URL's path:/usersonhttps://api.example.com/v1goes to/v1/users. - An absolute URL is used unchanged. The editor then reminds you that the connection's base URL is not applied. The connection's allowed domains still apply, so an absolute URL on another host is refused.
- The path can contain expressions, for example
/repos/acme/website/issues/{{ $trigger.number }}. Query parameters from the Params tab are appended as usual. - When you pick a connection with a base URL on a new node, the URL field changes from the placeholder to
/.
A relative URL without a base URL fails the node:
The URL '/users' is relative: select a connection with a base URL, or use an absolute URL.
Default headers
Default headers are sent with every request made with the connection: from the HTTP Request block, from App Action and App Trigger nodes, and from Test connection.
In the HTTP Request node, the Headers tab shows them read-only under From the connection. To change one for a single request, add a header with the same name in Request Headers. Request headers always win: a default header is only added when neither the request nor the connection's authentication already set it.
For example, with GitHub's default Accept: application/vnd.github+json, a node that needs the raw file content
can set Accept: application/vnd.github.raw+json in its own headers.
Default headers are for fixed, non-secret values, such as API versions or Accept types. Credentials belong in the
connection's fields, where they are encrypted and masked. A custom app can have at most 50 default headers, and
these headers can't be set as defaults: Host, Content-Length, Transfer-Encoding, Connection, Upgrade,
Proxy-Authorization, TE, Trailer and Keep-Alive.
Test request
Test connection (on the Connections page, ⋯ → Test connection) sends the app's test request with the
credentials and default headers applied. The test URL can be absolute (https://api.example.com/v1/me) or a path
relative to the base URL (/me). A relative test URL needs a base URL.
The test request's method comes from the app: GET (the default), HEAD or POST. In a custom app, pick it next
to the Test request path. A POST test request can carry a JSON body, set in the app's manifest (testRequest
with method, path and body); see the manifest reference. Use it for APIs
whose "who am I" call is a POST, such as a GraphQL endpoint. The official Linear app tests this way:
{
"testRequest": {
"method": "POST",
"path": "/graphql",
"body": { "query": "{ viewer { id } }" }
}
}
When your project has environments, you can test the configuration of one environment (⋯ → Test connection → In …). The result is shown, but the connection's status is only updated by tests of the default configuration.
| Result | Meaning |
|---|---|
| Connected — api.github.com answered 200. | The credentials work. The connection is marked Healthy. |
| api.github.com rejected the credentials (401). | The API answered 401 or 403. The connection is marked Auth failed. |
| api.example.com answered 404 Not Found. | The test URL is wrong; the connection's status is not changed. |
| Credentials are configured. Add a test request to the app to verify them against the API. | The app has no test request, so only the presence of the credentials (and, for OAuth, a valid token) was checked. |
Pick a cheap, read-only endpoint that always needs authentication, such as /user, /me or /account.