API reference
OpenAPI JSONIntegration guide for AI agents
Build it with an AI agent
Paste this into your coding agent (Claude Code, Cursor, Codex…). It points the agent at the integration guide for AI agents, which covers identification, attribution, previews, posting, errors and the picker's UX.
Add a GIF button to my Nostr app using the nostr.build GIF API.
Before writing any code, read https://gifs.nostr.build/llms.txt and the integration guide it links (https://gifs.nostr.build/developers/llms-full.txt), and follow the guide exactly: how my app identifies itself (Origin for web, API key from native code), the required "GIFs from nostr.build" attribution, the previews to show in the grid, posting the GIF's url with a NIP-92 imeta tag, and the error and rate-limit handling.
First tell me what you need from me (a registered origin or an API key from https://gifs.nostr.build/developers), then build it, and finish by going through the guide's "Before you call it done" checklist.Authentication
Every request must identify a registered client. Browsers send an Origin header automatically. Native apps send Authorization: Bearer gnb_… with an API key, or a User-Agent that has been reviewed. Register your client.
Attribution
Show "GIFs from nostr.build", linked to https://nostr.build, wherever these GIFs appear — for example in your GIF picker's header.
GIFs from <a href="https://nostr.build" target="_blank" rel="noopener noreferrer">nostr.build</a>Registering a client costs 1000 sats, once. The fee only keeps spam sign-ups out — it isn't profit and doesn't fund the site. It isn't refunded if you delete the client.
Animated previews and MP4
Every item links its original as url (post that in a note) and comes with smaller files to show while picking one.
previews.small.animated,previews.medium.animated- Animated WebP at a fixed height of 96 or 192 px, for grids.
nullwhen the GIF is too large to animate: show the still. For column grids usepreviews.w240andpreviews.w480instead: fitted to a width (at most 240 or 480 px, never enlarged), same shape. previews.small.still,previews.medium.still- The first frame as PNG, same sizes. A poster while the animation loads, or the preview when there is none.
mp4- The animation as H.264 at its source size, many times smaller than the GIF. No audio and no loop flag, so play it muted and looping; transparency is shown on black.
nullfor stills and past 60 s, 1800 frames or 4096 px.
<video src="…/mp4/orig/…" loop muted autoplay playsinline
poster="…/still/192/…"></video>An mp4 can still answer 404 when it is converted on first request and that fails: on the video's error event, fall back to the animated preview or url.
Endpoints
GET /api/v1/search
Search GIFs
Parameters
| Name | In | Required | Type | Default | Description |
|---|---|---|---|---|---|
q | query | yes | string | What to find: words in any language, emoji, or both. An emoji is searched by its meaning (😂 finds laughing faces, 🇺🇸 the flag; skin tones are ignored). Punctuation and search syntax are ignored; the first 100 characters are searched. | |
limit | query | no | integer | 24 | |
offset | query | no | integer | null | 0 | |
mode | query | no | "auto" | "text" | "semantic" | "auto" | |
safe | query | no | "0" | "1" | "1" | 1 (default) excludes adult GIFs. |
Responses
GET /api/v1/suggest
Autocomplete search terms
Parameters
| Name | In | Required | Type | Default | Description |
|---|---|---|---|---|---|
q | query | yes | string | ||
limit | query | no | integer | 8 | |
safe | query | no | "0" | "1" | "1" | 1 (default) excludes adult GIFs. |
Responses
GET /api/v1/gifs/{id}/similar
GIFs similar to one GIF
Parameters
| Name | In | Required | Type | Default | Description |
|---|---|---|---|---|---|
id | path | yes | string | ||
limit | query | no | integer | 24 | |
safe | query | no | "0" | "1" | "1" | 1 (default) excludes adult GIFs. |
Responses
Schemas
Gif
| Property | Required | Type | Description |
|---|---|---|---|
id | yes | string | |
url | yes | string | The original, to post in a note. |
width | yes | integer | |
height | yes | integer | |
frames | yes | integer | null | |
duration | yes | number | null | |
bytes | yes | integer | null | |
format | yes | "gif" | "webp" | |
title | yes | string | |
tags | yes | string[] | |
lqip | yes | string | null | |
mp4 | yes | string | null | The animation as H.264 MP4 at its own size, many times smaller than the GIF; for grids. No audio and no loop flag: play it with `<video loop muted autoplay playsinline>`. Transparency is shown on black. null when it cannot be converted (a still, over 60 s, 1800 frames or 4096 px). |
previews | yes | object |
Error
| Property | Required | Type | Description |
|---|---|---|---|
error | yes | object |