APIs

Claude + External APIs: A Safe Tool-Use Guide (2026)

Connect Claude to external APIs with validated tool calls, private credentials, explicit permissions, and review before important changes.

Posted by the Qlauson TeamPublished Last updated — views4 min read
Share story
Conceptual editorial still life illustrating apis: Claude + External APIs: A Safe Tool-Use Guide (2026)
Conceptual editorial illustration / APIs. Not a product screenshot.

The short answer

For a custom client tool, Claude proposes a structured call; your application decides whether to execute it. Keep credentials and authorization outside the model, and return results with the matching tool-use identifier.

Connect Claude to external APIs with validated tool calls, private credentials, explicit permissions, and review before important changes.

01 / The story

How does Claude call an external API?

A custom tool describes an action using a name, description, and input schema. Claude can return a tool_use block naming that tool and its inputs. Your application reads the request, checks it, calls the allowed API, and sends back the result. The model does not gain unlimited network access just because you describe a tool.

Anthropic distinguishes client tools from provider-run server tools. This guide focuses on client tools for services you control or have permission to use. Do not confuse this pattern with giving a chat app a password or assuming every hosted tool follows your own execution policy.

02 / The story

Define one narrow read-only tool first

Start with something bounded, such as fetching the status of an order the signed-in user may see. Describe exactly what the tool returns and when it should be used. Prefer explicit fields to an arbitrary URL or free-form database query.

Validate the proposed arguments against your own schema after receiving them. Also check ownership, account scope, and permitted values. A valid JSON object is not evidence that the caller may access the named record.

JSON — illustrative tool definition / Example

{
  "name": "get_order_status",
  "description": "Read status for one order belonging to the signed-in user. No changes.",
  "input_schema": {
    "type": "object",
    "properties": {
      "order_id": {
        "type": "string"
      }
    },
    "required": [
      "order_id"
    ],
    "additionalProperties": false
  }
}

03 / The story

Keep the execution boundary outside the conversation

Load API credentials only in your trusted application service. Choose allowed hosts in code, enforce timeouts and response-size limits, and restrict which endpoints the tool can call. Never let model output select internal network addresses or a secret-bearing request destination.

External results are untrusted data. A support note or API response can contain malicious instructions. Return only the fields the task needs, strip unnecessary personal data, and never obey instructions from the result to change permissions or disclose credentials.

04 / The story

Return tool results in the correct message order

Anthropic’s handling guide requires the tool_result to carry the matching tool_use_id. Tool-result messages immediately follow the corresponding assistant tool-use message; tool results come before any ordinary text in the user message. Preserve the assistant content rather than replacing it with a summary.

Handle multiple proposed calls deliberately. Run only authorized calls, return appropriate errors when they fail, and continue the loop within a fixed budget. The guide supports marking an error result with is_error. Do not send stack traces, tokens, or private upstream responses back to the model.

  • Inspect every proposed tool and its arguments.
  • Authorize the current user against the target record.
  • Execute only an allowed action with bounded time and size.
  • Return the result with its matching identifier.
  • Stop when the goal is met or the budget is exhausted.

05 / The story

Require review before consequential writes

For sending messages, changing records, or spending money, show the exact action for approval. Bind that approval to the final target and arguments so later model changes cannot quietly alter it. A vague earlier instruction to “handle this” is not enough for every future action.

Plan retries with the upstream API’s supported duplicate-prevention mechanism. A timed-out write may already have succeeded. Check the result before retrying, record an audit trail without secrets, and give an owner a way to stop the loop. API terms, data rights, and rate limits still apply.

A closer look

What is verified for 2026—and what is not known for 2027

Anthropic’s tool definition, overview, and handling guides were checked October 14, 2026. The JSON example illustrates a schema, not a running integration. Authorization, approvals, and restricted network access are application responsibilities, not promises made by the model.

No checked source confirms universal access to external services or a new tool permission system in 2027. Recheck current SDK formats, provider terms, and the external API’s capabilities before deployment.

Put it to work

Before you put this into practice

Use these questions for a small, low-risk trial. This is editorial guidance, not a certification.

0 of 6 considered

These questions are editorial guidance, not a product score or verified assessment.

Keep learning

Further reading

This article is Qlauson Team editorial guidance, not a product test or endorsement. Product details can change; verify them with the provider. See our Disclosure for how we approach coverage.
Share story

Read next

Why AI API Bills Surprise People — and How to Prevent It

Documented cases of runaway AI API bills—from $47 overnight loops to a $17,600 startup dispute—and the spend limits, alerts, and code-level caps that prevent them.

Continue reading

Newsletter

Get new Qlauson stories by email.

An occasional email when we publish a new guide or update an important one. No unrelated promotions, and you can unsubscribe from any email.

Read our Privacy Policy.

Good to know

Frequently asked questions

Should I put an API key in Claude’s prompt?

No. Keep credentials in a trusted service or secret manager and let that service execute authorized requests.

Can Claude run any API I describe?

Not for custom client tools by itself. Your application implements and permits the actual call.

What is tool_use_id for?

It links a tool result to the specific tool-use request. Use the identifier returned with that request.

Is a valid tool schema enough for security?

No. Enforce authorization, allowed destinations, budgets, and approvals outside the model.

Behind the article

Sources & how we organized the information

These are the primary documents used as references for this guide. Each note explains what the source covers.

  1. Anthropic: handle tool calls

    Matching tool results, message ordering, and errors.

    Source checked Oct 14, 2026 · Opens in a new tab.

  2. Anthropic: define tools

    Tool names, descriptions, and input schemas.

    Source checked Oct 14, 2026 · Opens in a new tab.

  3. Anthropic: tool use overview

    Client tools versus provider-run tools.

    Source checked Oct 14, 2026 · Opens in a new tab.

How the information is organized

The short answer comes first. The main guide then covers How does Claude call an external API; Define one narrow read-only tool first; Keep the execution boundary outside the conversation; Return tool results in the correct message order; Require review before consequential writes. Practical notes, a checklist, and FAQs turn those topics into questions to consider for your own situation.

Source documents describe provider features, technical guidance, or standards. Qlauson’s examples, comparisons, and checklists organize that information into practical advice; they are not original test results, a measured ranking, or a provider endorsement.

Product details and prices can change after a source is checked. Confirm current details with the provider before making a decision. References to future releases are possibilities, not confirmed availability.

Keep exploring

Related articles