# The API

The v1 API allows a script, application, or AI without MCP to read and modify your Vyse projects. It is versioned: what is listed here does not change without notice.

## Getting Started

```bash
curl https://api.vyse.cloud/api/v1/context -H "Authorization: Bearer vyse_..."
```

The response tells you where you are: your organization, your scopes, and each project with its ID, type, and what you can do there.

```json
{
  "apiVersion": "v1",
  "key": {"id": "...", "name": "Claude Desktop", "scopes": ["read", "write", "manage"], "restrictedToProjects": []},
  "organization": {"id": "...", "name": "E2E Studio", "slug": "e2e-studio"},
  "projects": [{
    "id": "2b182a39-...",
    "name": "Medieval Pack",
    "type": "JAVA",
    "platforms": ["java", "bedrock"],
    "atlasLayout": "LEGACY",
    "access": {"role": "OWNER", "external": false, "canRead": true, "canWrite": true, "canManage": true}
  }],
  "hints": ["..."]
}
```

## Address and Authentication

The API lives under `https://api.vyse.cloud/api/v1`. Each request sends the key, either via:

```text
Authorization: Bearer vyse_...
X-Vyse-Api-Key: vyse_...
```

The front API (`/api/...` without `v1`) serves the web application. It is not stable and rejects API keys; the v1 API rejects user sessions. The two do not exchange the same objects: the v1 API has its own formats, organized into three families.

| Family | Route Prefix | For |
|---|---|---|
| Common | `/api/v1/...` | Context, projects, tree structure, categories, folders, textures, global search |
| Java | `/api/v1/projects/{id}/java/...` | Blocks, supplies, entities, vanilla blocks of a Java project |
| Bedrock | `/api/v1/projects/{id}/bedrock/...` | Bedrock settings for blocks and supplies |

See [Java and Bedrock](/reference/java-and-bedrock).

## Context and Projects

| Method | Route | Scope |
|---|---|---|
| GET | `/context` | read |
| GET | `/projects` | read |
| POST | `/projects` | manage |
| GET | `/projects/{projectId}` | read |
| GET | `/projects/{projectId}/tree` | read |
| GET | `/projects/{projectId}/settings` | read |
| PATCH | `/projects/{projectId}/settings` | manage |

The tree structure gives categories, their folders, and the number of assets:

```bash
curl "https://api.vyse.cloud/api/v1/projects/<projectId>/tree" -H "Authorization: Bearer vyse_..."
```

```json
{
  "project": {"id": "...", "type": "JAVA"},
  "categories": [{
    "category": {"id": "61e9...", "name": "Furniture", "type": "CUSTOM_PACK"},
    "directories": [
      {"id": "9475...", "name": "Stones", "type": "CUSTOM_BLOCK", "assetCount": 2},
      {"id": "d70a...", "name": "Tables", "type": "FURNITURE", "assetCount": 1}
    ]
  }]
}
```

Changing a project's configuration (scope `manage`, role **MANAGER**):

```bash
curl -X PATCH "https://api.vyse.cloud/api/v1/projects/<projectId>/settings" \
  -H "Authorization: Bearer vyse_..." -H "Content-Type: application/json" \
  -d '{"activeDefaultPack": false, "glslEmissive": true, "textureExportReference": "SLUG"}'
```

| Field | Values |
|---|---|
| `name` | 3 to 20 characters |
| `activeCustomPack`, `activeDefaultPack` | Export the custom pack, the vanilla pack |
| `textureExportReference` | `SLUG` or `UUID`: names of exported texture files |
| `serverExportPlatform` | `ITEMS_ADDER`. `NEXO` returns `503` while Nexo is disabled. |
| `glslEmissive` | Emissive shaders |

## Categories and Folders

| Method | Route | Scope |
|---|---|---|
| POST | `/projects/{projectId}/categories` | write |
| GET, PATCH, DELETE | `/categories/{categoryId}` | read, write, write |
| GET, POST | `/categories/{categoryId}/directories` | read, write |
| GET, PATCH, DELETE | `/directories/{directoryId}` | read, write, write |

```bash
curl -X POST "https://api.vyse.cloud/api/v1/categories/<categoryId>/directories" \
  -H "Authorization: Bearer vyse_..." -H "Content-Type: application/json" \
  -d '{"name": "Tables", "type": "FURNITURE"}'
```

`PATCH` renames (`{"name": "..."}`). `DELETE` moves the element and its content to the project trash; it can be restored from the application.

## Textures

| Method | Route | Scope |
|---|---|---|
| GET | `/projects/{projectId}/textures?objectType=&query=&limit=` | read |
| POST | `/projects/{projectId}/textures` | write |
| GET | `/projects/{projectId}/textures/{textureId}?includeContent=true` | read |

```bash
curl -X POST "https://api.vyse.cloud/api/v1/projects/<projectId>/textures" \
  -H "Authorization: Bearer vyse_..." -H "Content-Type: application/json" \
  -d '{"slug": "oak_table_top", "objectType": "FURNITURE", "pngBase64": "iVBORw0KGgo..."}'
```

`objectType`: `BLOCK_CUSTOM` (block faces), `FURNITURE`, `ENTITY`, `ITEM`, `BLOCK`, `JAVA_MODEL`. Vyse applies the texture with assets of the relevant type; identical content is reused. Max 10 MB.

## Java Assets

These routes apply only to **JAVA** projects. On a Bedrock project, they return `409` with the route to use.

| Method | Route | Scope |
|---|---|---|
| GET | `/projects/{p}/java/blocks?directoryId=` | read |
| POST | `/projects/{p}/java/directories/{directoryId}/blocks` | write |
| GET, PATCH, DELETE | `/projects/{p}/java/blocks/{blockId}` | read, write, write |
| GET | `/projects/{p}/java/furniture?directoryId=&includeModel=` | read |
| POST | `/projects/{p}/java/directories/{directoryId}/furniture` | write |
| GET, PATCH, DELETE | `/projects/{p}/java/furniture/{furnitureId}` | read, write, write |
| GET | `/projects/{p}/java/entities?directoryId=&includeModel=` | read |
| POST | `/projects/{p}/java/directories/{directoryId}/entities` | write |
| GET, PATCH, DELETE | `/projects/{p}/java/entities/{entityId}` | read, write, write |
| GET, POST | `/projects/{p}/java/vanilla-blocks` | read, write |
| GET, PATCH, DELETE | `/projects/{p}/java/vanilla-blocks/{blockstateId}` | read, write, write |

An asset is created in a folder of the correct type: a block in a `CUSTOM_BLOCK` folder, otherwise `409`. Full examples: [Your first block](/first-steps/your-first-block), [Your first supply](/first-steps/your-first-furniture-item).

Adding a vanilla block to the vanilla pack (category `VANILLA_PACK`):

```bash
curl -X POST "https://api.vyse.cloud/api/v1/projects/<projectId>/java/vanilla-blocks" \
  -H "Authorization: Bearer vyse_..." -H "Content-Type: application/json" \
  -d '{"blockName": "oak_planks", "categoryId": "<vanillaCategoryId>"}'
```

When multiple copies of a vanilla block exist, only one provides the exported files: `PATCH .../vanilla-blocks/{id}` with `{"exportSelected": true}`.

These routes do not edit models, blockstate rules, or vanilla texture overrides. Use the Vyse interface for these settings; see [Organize Vanilla Pack Blocks](/first-steps/organizing-vanilla-pack-blocks) and [Replace a Vanilla Texture](/first-steps/replace-a-vanilla-texture).

## Bedrock Assets

| Method | Route | Scope |
|---|---|---|
| GET | `/projects/{p}/bedrock/assets?kind=block\|furniture` | read |
| GET, PATCH | `/projects/{p}/bedrock/assets/{kind}/{assetId}` | read, write |

`PATCH` accepts `exportEnabled`, `collisionBox`, and `selectionBox`. See [Hitboxes](/first-steps/hitbox-java-and-bedrock).

## Global Search

Don't know which project an asset is in? Search across all your projects at once:

```bash
curl "https://api.vyse.cloud/api/v1/assets?query=stone&kind=BLOCK" -H "Authorization: Bearer vyse_..."
```

```json
[{
  "id": "2a8afd05-...",
  "kind": "BLOCK",
  "name": "Polished stone",
  "location": {"projectId": "...", "projectName": "Medieval Pack", "projectType": "JAVA",
               "categoryName": "Furniture", "directoryName": "Stones"},
  "platforms": ["java", "bedrock"],
  "links": {
    "asset": "/api/v1/assets/2a8afd05-...",
    "java": "/api/v1/projects/.../java/blocks/2a8afd05-...",
    "bedrock": "/api/v1/projects/.../bedrock/assets/block/2a8afd05-..."
  }
}]
```

`GET /api/v1/assets/{assetId}` locates any block, supply, or entity by its ID alone.

## Model Conversions

Without saving anything:

| Route | Input | Output |
|---|---|---|
| `POST /tools/java/bbmodel-to-java-model` | `{"bbModel": "..."}` | `{"javaModel": "..."}` |
| `POST /tools/java/java-model-to-bbmodel` | `{"javaModel": "...", "textures": {"block/stone": "<png base64>"}}` | `{"bbModel": "...", "missingTextures": []}` |

## Errors

All errors have the same format, with a message saying what to fix:

```json
{"status": 409, "error": "CONFLICT", "message": "Directory d70a... holds FURNITURE assets, not CUSTOM_BLOCK. Create the asset in a CUSTOM_BLOCK directory.", "requestId": "req_...", "timestamp": "..."}
```

See [Errors](/reference/errors).

## Next Steps

- [The MCP Server](/automate/the-mcp-server)
- [Java and Bedrock](/reference/java-and-bedrock)
- [Permissions](/reference/permissions)
