# Build Backend HTTP Outcalls in Motoko

Backend canisters need a reliable way to call external APIs. This skill shows how to use the Caffeine AI outcall module for GET and POST requests.

## Install

```bash
npx skillstore add caffeinelabs/extension-http-outcalls
```

## Metadata

- Status: approved
- Slug: caffeinelabs-extension-http-outcalls
- Version: 0.1.6
- Author version: 0.1.6
- Skillstore revision: r2
- Version status: valid
- Tree hash: 3f6ca28509cf66f91057866ff8398dfcc6eb33deca573057872253ab724155a8
- Author: caffeinelabs
- GitHub username: caffeinelabs
- License: MIT
- Repository: https://github.com/caffeinelabs/skills/tree/main/skills/extension-http-outcalls/
- Ref: a39a91716eadede5f4cdefd78178fed4e837a128
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands, network
- Quality score: 80
- Quality tier: silver
- Public page: https://skillstore.pages.dev/skills/caffeinelabs-extension-http-outcalls
- Manifest: https://skillstore.pages.dev/api/skills/caffeinelabs-extension-http-outcalls/manifest

## Capabilities

- Explains how backend canisters make HTTP GET and POST requests.
- Documents the prefabricated Caffeine AI outcall module interface.
- Defines the request header and transformation callback types.
- Shows a Motoko GET request with the provided transform helper.
- Clarifies that JSON parsing should be handled by the frontend.

## Use Cases

- Connect a First External API: Add a basic backend GET request and transform callback to a Motoko canister.
- Integrate a Service Backend: Plan GET and POST calls from a canister to an external service.
- Review Canister Request Design: Check module usage, response transformation, and frontend JSON handling before implementation.

## Prompt Templates

### Explain a Backend GET Outcall

```
Explain how this skill performs a backend GET request to [API URL]. Identify the import, transform callback, and request call.
```

### Draft a GET Integration

```
Draft a Motoko backend function that sends a GET request to [API URL] with [headers] and uses the provided transform callback.
```

### Plan a POST Outcall

```
Plan a POST outcall from a backend canister to [service]. Specify headers, body handling, transform usage, and response processing boundaries.
```

### Review an Outcall Architecture

```
Compare backend GET and POST integration options for [service]. Recommend function boundaries, reusable headers, transform handling, and frontend JSON parsing.
```

## Limitations

- The guidance applies to backend canisters, not frontend requests.
- The prefabricated outcall module cannot be modified.
- Motoko does not directly support the described JSON parsing workflow.
- POST support is described, but only GET has a complete usage example.

## Best Practices

- Keep HTTP outcall logic in backend canister functions.
- Use the provided transform helper through a query callback.
- Validate request targets and avoid sending secrets to untrusted services.

## Anti Patterns

- Do not modify the prefabricated outcall module.
- Do not assume Motoko directly parses JSON responses in this workflow.
- Do not pass untrusted URLs directly into backend outcall functions.

## Security Audit

- Audited at: 2026-07-23T12:05:01.466\+00:00
- Summary: All five static findings are false positives. Four detections mistake Markdown backticks and Motoko code fences for shell execution, while the URL is a documentation link. No evidence of prompt injection or malicious intent was found.

## Stats

- Views: 0
- Downloads: 5
- Favorites: 0
- Popularity score: 0
