> ## Documentation Index
> Fetch the complete documentation index at: https://docs.glif.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Glif API 

***(Beta public preview)***

The Glif API gives you access to Glif's AI media capabilities through a single HTTP endpoint. You can compose Glif projects, generate images, video, and audio, manage assets, and receive structured media results.

> **Note:** The API is currently in beta public preview and may change as we continue to improve it.

## OpenAPI Specification

The Glif API provides an OpenAPI 3.1 specification for generated clients, API explorers, and schema-aware tooling.

* **OpenAPI YAML** — Canonical OpenAPI 3.1 specification
* **OpenAPI JSON** — Use with Postman, Insomnia, and other API tools
* **Swagger Editor** — Browse the API specification interactively

## What You Can Build

### Project-Based Media Generation

Compose durable Glif projects from natural-language prompts. Glif can choose the appropriate models, run the necessary tools, and return links to the generated media.

### Assets and Media

Upload files to use as references, and retrieve a project's generated media and recent messages with `get_project`.

### One Endpoint, Agent-Ready

The Glif API uses the same underlying interface as the Glif MCP server. You can connect an AI agent through MCP or call the API directly over HTTP.

## Quickstart

The API uses the MCP endpoint and JSON-RPC 2.0.

First, create an API token and replace `$GLIF_TOKEN` in the example below with your token.

```bash theme={null}
curl https://glif.app/api/mcp \
  -H "Authorization: Bearer $GLIF_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"compose_project","arguments":{"prompt":"a watercolor fox in a snowy forest","intelligence":"smart"}}}'
```

The `intelligence` parameter determines which Glif agent runs your project:

* `lite`
* `smart` — the default
* `genius`

## API Overview

| Property | Value |
| - | - |
| **Endpoint** | `POST https://glif.app/api/mcp` |
| **Authentication** | `Authorization: Bearer glif_v1_...` |
| **Accept header** | `application/json, text/event-stream` |
| **Format** | JSON-RPC 2.0 over HTTP |

Both accepted content types should be included in the `Accept` header.

## Wire Format

The API uses **JSON-RPC 2.0**, allowing all functions to share a single authenticated endpoint and response format.

A function call uses:

* `method: "tools/call"`
* `params.name` — the name of the tool to call
* `params.arguments` — the tool's input arguments

To retrieve the authoritative, machine-readable input and output schema for every available tool, call `tools/list`.

The OpenAPI specification also documents the endpoint and available tool set for API-catalog and developer tooling.

## Reference

The following resources provide additional information about the API:

* **OpenAPI YAML** — Canonical OpenAPI 3.1 specification
* **OpenAPI JSON** — API schema for Postman, Insomnia, and code generators
* **LLM-readable capabilities** — Machine-readable information about the API
* **JSON-RPC 2.0** — Wire protocol specification
* **MCP server** — Setup instructions for connecting Glif to AI agent clients

## API Status

The Glif API is currently in **beta public preview**. API behavior, tools, and schemas may change while we continue to improve the platform.

## Questions and Feedback

For questions or feedback about the API and MCP, join the Glif Discord and post in `#api-mcp`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.