---
title: "Upload one chunk of a sliced G-code"
method: POST
path: "/api/prints/slicing/gcode-chunk"
tags: ["slicing"]
---

# Upload one chunk of a sliced G-code

`POST /api/prints/slicing/gcode-chunk`

## Request

- Base URL: `https://www.immersivecommons.com`
- URL: `https://www.immersivecommons.com/api/prints/slicing/gcode-chunk`
- Auth: HTTP bearer

SLICE_SERVICE_SECRET bearer. The chunked transport exists because base64-in-JSON died at the platform's ~4.5MB body cap for real parts. Idempotent per (request_id, seq): a replayed chunk does not double-count. `complete` turns true once every seq has landed, which is the signal to call gcode-commit.

## Request body

- GcodeChunkRequest
  - `request_id` string, required
  - `seq` integer, required: 0-based. Idempotent per (request_id, seq) — a replay does not double-count.
  - `total_chunks` integer, required
  - `total_size` integer, required: Bytes of the whole reassembled G-code.
  - `chunk_b64` string, required: ~3MB of base64 per chunk.

## Response `200`

How many chunks have landed so far.

- GcodeChunkResponse
  - `ok` boolean, required
  - `received` integer, required: Distinct chunks landed so far.
  - `total` integer, required
  - `complete` boolean, required: true is the signal to call gcode-commit.

## Other responses

- `400`: Invalid JSON, missing request_id, or a chunk that fails validation.
- `401`: Wrong or missing service secret.
- `413`: Chunk or declared total over the ceiling.
- `503`: SLICE_SERVICE_SECRET is not configured.

---

[API](https://skmtc.dev/immersivecommons/apis/immersive-commons-agent-rest-api.md) · [All operations](https://skmtc.dev/immersivecommons/apis/immersive-commons-agent-rest-api/llms.txt) · [OpenAPI document](https://skmtc.dev/immersivecommons/apis/immersive-commons-agent-rest-api/revisions/be67c1f67c27?raw)
