How To Connect Any API To An AI Agent
Get three things from the service’s API documentation: the base URL, a key, and how the key is sent, usually an Authorization: Bearer header. Add them in your agent platform’s connection screen instead of pasting the key into a chat, give the connection only to the agents that need it, and test with a read-only request first.
How To Do It
These steps work with the tools you already have, whatever you use.
-
Check That The Service Has An API
Look for “API” or “developers” in the service’s help center or settings. Most business software offers one, and so do most tools a developer has built for you.
-
Find The Base URL
The documentation lists the address every request starts with, such as https://api.example.com/v1. Copy it exactly.
-
Create A Key With Narrow Access
Make a new key just for agents in the service’s settings, read-only to begin with. A separate key can be switched off without breaking anything else.
-
Note How The Key Is Sent
The docs say whether the key goes in an Authorization: Bearer header, in a header with its own name, or in the address as a parameter.
-
Keep The Key Out Of Chats And Documents
Paste it only into the connection screen of the tool you use. A key in a chat or a shared document can be copied by anyone who reads it.
-
Test With A Read-Only Request
Ask for something you can check, like the newest record, and compare it with what the service itself shows.
What To Watch Out For
- Keys don’t last forever. If a connection stops working, check whether the key was changed or switched off.
- Some APIs limit how many requests you can make in a minute or a day. Ask for summaries rather than every record.
- If the service also has an MCP server, use that: it already describes its tools in a way AI apps understand.
How Octopus Prime Does It
Octopus Prime adds your API as a connection for the agents you pick, with the key kept on the computer.
-
Add A Connection
Open Settings › Connections in the web app, press Add a connection and choose API. The desktop app’s Connections page adds MCP servers; add APIs in the web app.
-
Fill In The Form
Enter a name, the base URL and how the key is sent, then paste the key. It goes to the computer’s protected store and isn’t shown again.
-
Choose The Agents
Pick the computer and tick the agents that may use the API. Change the list any time with Change agents.
-
Test It
Press Test on the connection’s row, then ask a ticked agent for something you can check against the service.
From $10/month 30 days free No credit card
Questions
Can an AI agent use any API?
Most APIs that take a key work. The agent platform needs the base URL, the key and how the key is sent, all listed in the service’s documentation.
Do I need to code to connect an API?
No. You copy three things from the documentation into a form. Writing an API of your own is the part that needs a developer.
Where should I keep the API key?
In the tool’s own connection screen or a password safe, never in a chat, an email or a shared document.
Should I use MCP or an API?
If the service offers an MCP server, it’s the quicker route for AI. If it only offers an API, connect that.
Let your agent do the steps. You approve what matters.
From $10/month 30 days free No credit card
All product names, logos and brands are property of their respective owners.