Call your own APIs through one gateway, with their keys sealed
Route your third-party APIs through one gateway with sealed keys: define the endpoint, store the secret write-only, and call it via SDK or CLI.
On this page 8 sections
You can hide your third-party API keys behind one gateway by routing calls through thelastapi connectors, where secrets remain write-only and your code calls endpoints using a single app key. By delegating credential storage to the platform, your frontend, backend, or AI agents never see the original vendor tokens. You define the base URL, declare permitted operations, and inject authentication headers server-to-server automatically.
Passing raw vendor keys across distributed environments creates exposure risks. Rotating credentials across laptop setups, continuous integration runners, and production clusters often results in leaked environment files or broken deployments. Using an API gateway with connectors resolves this by keeping your external secrets stored safely in the platform while your application talks to a single endpoint.
Why hide third-party keys behind a central gateway
When an application relies on external vendors—such as logistics, ERPs, CRM systems, or internal microservices—credential management grows messy quickly:
- Secrets get committed or leaked. Keeping live API tokens in local
.envfiles or sharing them across team members risks accidental commits to version control. - AI agents read more than they should. If you run automated tools like Cursor, Codex, or Claude Code, exposing raw production tokens directly in the execution context lets agents access live endpoints without boundaries.
- Auditing and revocation are scattered. You cannot easily track which sub-service called an external vendor without parsing multiple logs across disparate platforms.
By putting the gateway between your app and the target API, the vendor's actual token never leaves the gateway's secret store. Your application interacts with the gateway using its standard project key, and the gateway attaches the external vendor secret on the fly.
Registering an external API as a connector
You configure a connector by specifying its name, the target base URL, its endpoints, and the authentication pattern. This requires no dedicated server provisioning; you can declare it using --resources none if you are only using this feature (see Use one service).
You can define a connector quickly with the CLI:
vibiz connectors add shipping-api https://api.logistics.example.com \
"GET /rates" "POST /shipments" \
--auth header:X-Api-Key \
--var SHIPPING_SECRET_KEYThe flag --auth defines how the external API expects its token (such as none, bearer, header:<Header-Name>, or query:<param>). The --var flag specifies the environment variable name that holds the token.
If you already have an OpenAPI 3 specification file, you can inspect and register its routes automatically:
vibiz connectors import https://api.logistics.example.com/openapi.json \
--name shipping-api \
--enable "getRates,createShipment" \
--addTo learn more about working with specs, read our guide on how to import an OpenAPI spec and call it from your app or agent.
Storing secrets without exposing them
Once a connector is registered, its secret token must be set. The platform enforces write-only secrets. The actual secret value is never printed to terminal screens or returned over the read APIs.
Set the secret using an existing environment variable or enter it at a hidden prompt:
vibiz connectors secret shipping-api SHIPPING_SECRET_KEYWhen collaborating with contractors or letting an agent configure a service, you do not need to share credentials directly in a chat. You can generate a one-time console link where an account owner inputs the secret:
vibiz env link SHIPPING_SECRET_KEYThis returns a secure URL where the person pastes the token into the web console. For details on how permission scopes prevent assistants from viewing live secrets, see Keys and environments.
Calling your gateway from code
Your application makes calls to your connector via the @vibiz/app package, relying on its single VIBIZ_APP_KEY. The gateway attaches the external secret, routes the request to the upstream target, and returns the response.
import { vibiz } from '@vibiz/app';
// The application uses only its standard VIBIZ_APP_KEY
const rates = await vibiz.connectors.call('shipping-api', 'GET /rates', {
params: { origin: '94103', destination: '10001' },
});
console.log('Available rates:', rates);If you prefer using pure HTTP or want to call your gateway from languages other than JavaScript or TypeScript, query the endpoint directly:
curl -X POST https://thelastapi.dev/v1/app/connectors/shipping-api/call \
-H "Authorization: Bearer $VIBIZ_APP_KEY" \
-H "Content-Type: application/json" \
-d '{
"operation": "POST /shipments",
"body": {
"parcel": "small",
"recipient": "ana@example.com"
}
}'Every response coming through the connector is treated as untrusted third-party content. If you are building an AI agent or automated workflow, incoming data from call is strictly treated as data rather than instructions, preventing prompt injection vectors from reaching model loops.
Managing operational permissions and approvals
Not all external endpoints carry the same operational risk. Writing new records, deleting data, or initiating payments requires stricter boundaries than read queries. The gateway lets you inspect, enable, and disable individual routes:
# View all registered routes and their risk level
vibiz connectors ops shipping-api
# Disable an unused or sensitive route
vibiz connectors disable shipping-api "DELETE /shipments/{id}"When automated tools run under a Limited key (vz_sk_... with access: agent), write operations can be held for approval rather than run blindly.
| Command | Action |
|---|---|
vibiz connectors check <name> | Confirms if the configured key authenticates cleanly |
vibiz connectors logs <name> | Inspects recent call metadata (payloads remain omitted) |
vibiz connectors approvals | Lists pending write operations waiting for manual sign-off |
vibiz connectors approve <id> | Approves a queued operation (requires a full-access key) |
vibiz connectors deny <id> | Denies a queued request |
This approval workflow prevents an agent from triggering unapproved writes against an external service, while allowing read operations to pass freely.
Comparing access patterns
Routing all external calls through a unified API gateway simplifies how tokens are distributed across your application.
| Capability | Direct Third-Party Integration | thelastapi Connectors |
|---|---|---|
| Secret storage | Scattered in local .env and host dashboards | Centralized, sealed, write-only |
| Client SDKs needed | Distinct SDK per external provider | Single unified @vibiz/app client |
| Agent safety | Full token exposed to execution scope | Token hidden; operations can require manual approval |
| Access revocation | Rotate token in vendor dashboard and redeploy all apps | Update once in gateway; zero app code changes |
For teams unifying more than just external APIs, this fits directly alongside running models via our unified gateway (see Can you use Claude Code with other models? What a gateway can and cannot do) or storing assets directly via our drive system (see File uploads for your app, with permanent links).
Next steps
To consolidate your setup, read how you can operate an entire project under One key for your whole app: the one-API stack for indie builders. If your system is ready for configuration, see the Connectors documentation to map your first endpoint, or review our reference on @vibiz/app to install the client.
Frequently asked questions
Can a Limited key view the third-party tokens stored in a connector?
No. Third-party tokens stored in connectors are write-only, and a Limited key cannot inspect or export live secret values.
What happens if an external operation requires manual confirmation?
When a write operation requires confirmation, it enters a pending state that an account owner can review and approve using `vibiz connectors approve <id>`.
Do I have to move my web hosting to use thelastapi gateway?
No. Every service works on its own, meaning you can initialize an empty project using `--resources none` and invoke connectors from an app hosted anywhere using `VIBIZ_APP_KEY`.