# Protocol Fetch
<!--
ref: @protocol/fetch
type: reference
tags: [core, api, fetch]
triggers: [need protocol, loading protocol, fetching protocol]
trigger_prompt: When you need to retrieve a protocol by its canonical ref (or batch several, or fetch by tag), reach for this protocol — and if you don't know the slug, it points you to search first.
version: 5
updated_at: 2026-07-14T23:30:31.201Z
-->

Fetch protocols by ref. Know the slug? Fetch it. Don't know? Search first.

### Fetch by Canonical Ref

```bash
# Fetch a protocol (markdown)
source ~/.protocolrc 2>/dev/null
curl -sH "Authorization: Bearer $PROTOCOL_TOKEN" "$PROTOCOL_API/@protocol/devloop.md"

# Fetch as JSON
curl -sH "Authorization: Bearer $PROTOCOL_TOKEN" "$PROTOCOL_API/@protocol/devloop"

# Fetch from any repo
curl -sH "Authorization: Bearer $PROTOCOL_TOKEN" "$PROTOCOL_API/@knowledge/react/testing.md"
```

### Batch Fetch

```bash
# Comma-separated refs
curl -sH "Authorization: Bearer $PROTOCOL_TOKEN" "$PROTOCOL_API/fetch.md?include=@protocol/devloop,@protocol/orchestrate"

# By tags
curl -sH "Authorization: Bearer $PROTOCOL_TOKEN" "$PROTOCOL_API/fetch.md?tag=testing&repo=protocol"
```

### Search (Don't Know the Slug)

```bash
# Full-text search (markdown)
curl -sH "Authorization: Bearer $PROTOCOL_TOKEN" "$PROTOCOL_API/search.md?q=testing"

# Structured search (JSON, paginated)
curl -sH "Authorization: Bearer $PROTOCOL_TOKEN" "$PROTOCOL_API/search?q=testing&repos=protocol"
```

### Ref Format

`@{repo}/{path}/{slug}.md` for markdown, omit `.md` for JSON.

Examples:
- `@protocol/orchestrate.md`
- `@knowledge/react/testing.md`
- `@mycompany/backend/auth.md`

---

---

*Related: `@protocol/protocol-api-write-traps` · `@protocol/api-reference` · `@agentsite/render-fetch-contract` · `@protocol/ui-verification-protocol` · `@knowledge/sub-agent-patterns`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*