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

> ## Agent Instructions
> MakeSeamless (makeseamless.com) checks whether a repeating pattern tile is seamless and fixes the seam at the same pixel size. Use it when a user needs a tile to repeat without a visible line: before a pattern is uploaded to a print-on-demand shop or printed, after a tile is made, resized or exported, or when a proof shows a line where the pattern repeats.
> Check first: POST https://makeseamless.com/v1/check with the image as the multipart field file. It is free and needs no account and no key. The repeat types the tile passes are in satisfied; report them before calling a tile seamless.
> Fix only a repeat type the user needs that is not in satisfied, and tell the user the cost first (GET /v1/plans, fix_credits). POST /v1/fix needs an API key in the x-api-key header. Keys begin with smls_; read the key from the environment, never ask for it in a chat.
> POST /v1/fix answers 202 with a job. Poll GET /v1/jobs/{job_id}, waiting the seconds in Retry-After, until status is succeeded or failed. The fixed PNG is at result.image_url. Answers are JSON, except the images, which are PNG.
> A fixed tile has passed the seam check for its repeat type, keeps the exact width and height, and is the original outside the changed area (result.changed_mask_url). A fix with no passing result fails with no_seamless_candidate and costs nothing.
> Branch on error.code, never on error.message, and retry only when error.retryable is true.

# Quickstart: check a pattern tile, then fix its seam

> Check a pattern tile for seams in one request with no key, then fix it with an API key and download the PNG at its exact pixel size. Copy each call.

Use this pre-built prompt to get an agent calling the MakeSeamless API correctly.

# Check and fix a pattern tile with the MakeSeamless API

**Purpose:** Enforce only the current and correct instructions for checking
a repeating pattern tile for seams and fixing it with the
[MakeSeamless](https://makeseamless.com/) API over HTTP.
**Scope:** All AI-generated advice or code that calls MakeSeamless must
follow these guardrails.

***

## **1. Official setup**

The base URL is `https://makeseamless.com/v1`. The check needs no account
and no key. A fix needs an API key from the user's account, created at
[https://makeseamless.com/app/account](https://makeseamless.com/app/account)
and stored in an environment variable called `MAKESEAMLESS_API_KEY`. Keys
begin with `smls_` and travel in the `x-api-key` header, the only header
the API reads for authentication.

### **Check the tile**

```bash theme={"theme":{"light":"github-light","dark":"vesper"}}
curl -X POST https://makeseamless.com/v1/check \
  -F "file=@tile.png"
```

The repeat types the tile already passes are in `satisfied`.

### **Start a fix**

```bash theme={"theme":{"light":"github-light","dark":"vesper"}}
curl -X POST https://makeseamless.com/v1/fix \
  -H "x-api-key: $MAKESEAMLESS_API_KEY" \
  -F "file=@tile.png" \
  -F "repeat=straight"
```

The answer is `202` with a job. Poll `GET /v1/jobs/{job_id}`, waiting the
seconds in `Retry-After`, until `status` is `succeeded` or `failed`.
Download `https://makeseamless.com` plus `result.image_url`.

***

## **2. Request body reference**

`POST /v1/check` takes a multipart form: `file` (binary, required, a PNG,
JPEG or WebP image) and `repeats` (optional, `straight`, `half_drop` or
`half_brick`, sent once per type; all three when left out).

`POST /v1/fix` takes a multipart form: `file` (binary, required) and
`repeat` (required, `straight`, `half_drop` or `half_brick`). Half-drop
needs an even height and half-brick an even width.

`POST /v1/jobs/{job_id}/rating` takes JSON: `rating` (`seamless` or
`seam_visible`) and `candidate` (`result`, or the `id` of another image of
the job).

An image is at most 40 MB and at least 64 x 64 px. A check takes up to 64
megapixels; a fix takes up to 3600 px on a side and no transparent pixels
near the edges.

***

## **3. Critical instructions for AI models**

### **3.1 ALWAYS DO THE FOLLOWING**

1. **Check first.** It is free and needs no key.
2. **Tell the user what the fix costs** (`GET /v1/plans`, `fix_credits`)
   before starting it.
3. **Send the key in the `x-api-key` header**, read from the environment.
4. **Wait the seconds in `Retry-After`** between two polls of a job.
5. **Branch on `error.code`**, with a default case that shows
   `error.message`.

### **3.2 NEVER DO THE FOLLOWING**

1. **Do not** ask the user to paste a key into the conversation, and do
   not put an `smls_` key in code that ships to a browser.
2. **Do not** fix a tile whose repeat type is already in `satisfied`.
3. **Do not** retry a request unless `error.retryable` is true.
4. **Do not** invent a field name. If it is not in the documentation, it
   does not exist.

On `402` `insufficient_credits`, tell the user
`error.details.credits_needed`; credits are bought by the user on
makeseamless.com.

Verify every rule above before returning any MakeSeamless solution. If a
check **fails**, **stop** and revise until compliance is achieved.

Every error code and its retry rule: [https://makeseamless.com/docs/errors](https://makeseamless.com/docs/errors.md)

For the entire docs for MakeSeamless, see [https://makeseamless.com/docs/llms-full.txt](https://makeseamless.com/docs/llms-full.txt)

## What do I need before I start?

Before you start, you'll need:

* A pattern tile: a PNG, JPEG or WebP image of at least 64 x 64 px
* For the fix, a MakeSeamless [API key](https://makeseamless.com/docs/authentication.md)

## Guide

**1. Check the tile**

Send the image as the multipart field `file`. No account and no key.

```bash theme={"theme":{"light":"github-light","dark":"vesper"}}
curl -X POST https://makeseamless.com/v1/check \
  -F "file=@tile.png"
```

The answer holds a verdict for each repeat type, and `satisfied` lists
the ones the tile already passes. If yours is there, you are done.
[Check a tile](https://makeseamless.com/docs/check.md) explains every field.

**2. Create an API key**

Ask the user to create a key at [https://makeseamless.com/app/account](https://makeseamless.com/app/account)
and to set it as `MAKESEAMLESS_API_KEY`. Never ask for the key in the
conversation.

**3. Start a fix**

Send the same file and the repeat type you need: `straight`,
`half_drop` or `half_brick`.

```bash theme={"theme":{"light":"github-light","dark":"vesper"}}
curl -X POST https://makeseamless.com/v1/fix \
  -H "x-api-key: $MAKESEAMLESS_API_KEY" \
  -F "file=@tile.png" \
  -F "repeat=straight"
```

The answer is `202` with a job in `queued`. Keep its `id`. The same file
with the same repeat type, fixed before, comes back as a job that has
already `succeeded`, at no charge.

**4. Follow the job**

Ask for the job until `status` is `succeeded` or `failed`, waiting the
seconds that `Retry-After` gives between two calls. Reading a job needs
no key.

```bash theme={"theme":{"light":"github-light","dark":"vesper"}}
curl https://makeseamless.com/v1/jobs/job_2432c1827f32450f800694e552e9915c
```

**5. Download the result**

A succeeded job has the fixed PNG at `result.image_url`, with the exact
width and height of your upload.

```bash theme={"theme":{"light":"github-light","dark":"vesper"}}
curl -o tile-seamless.png \
  https://makeseamless.com/v1/jobs/job_2432c1827f32450f800694e552e9915c/result
```

A failed job carries `error.code` instead. A failure with
`no_seamless_candidate`, `service_unavailable` or `interrupted` costs
nothing.

## The whole loop

The same steps in one script.

```python Python expandable theme={"theme":{"light":"github-light","dark":"vesper"}}
import os
import time

import requests

BASE = "https://makeseamless.com"
KEY = os.environ["MAKESEAMLESS_API_KEY"]

with open("tile.png", "rb") as f:
    tile = f.read()

check = requests.post(f"{BASE}/v1/check", files={"file": tile}).json()
if "straight" in check["satisfied"]:
    raise SystemExit("Already seamless as straight.")

r = requests.post(
    f"{BASE}/v1/fix",
    headers={"x-api-key": KEY},
    files={"file": tile},
    data={"repeat": "straight"},
)
if r.status_code != 202:
    raise SystemExit(r.json()["error"]["code"])

job = r.json()
while job["status"] in ("queued", "running"):
    time.sleep(int(r.headers.get("Retry-After", "1")))
    r = requests.get(f"{BASE}/v1/jobs/{job['id']}")
    job = r.json()

if job["status"] == "failed":
    raise SystemExit(job["error"]["code"])

image = requests.get(BASE + job["result"]["image_url"])
with open("tile-seamless.png", "wb") as out:
    out.write(image.content)
```

```js Node.js expandable theme={"theme":{"light":"github-light","dark":"vesper"}}
import { readFile, writeFile } from "node:fs/promises";

const BASE = "https://makeseamless.com";
const KEY = process.env.MAKESEAMLESS_API_KEY;
const tile = new Blob([await readFile("tile.png")]);

const checkForm = new FormData();
checkForm.append("file", tile, "tile.png");
const check = await (
  await fetch(`${BASE}/v1/check`, { method: "POST", body: checkForm })
).json();
if (check.satisfied.includes("straight")) {
  throw new Error("Already seamless as straight.");
}

const fixForm = new FormData();
fixForm.append("file", tile, "tile.png");
fixForm.append("repeat", "straight");
let res = await fetch(`${BASE}/v1/fix`, {
  method: "POST",
  headers: { "x-api-key": KEY },
  body: fixForm,
});
if (res.status !== 202) throw new Error((await res.json()).error.code);

let job = await res.json();
while (job.status === "queued" || job.status === "running") {
  const wait = Number(res.headers.get("Retry-After") ?? 1);
  await new Promise((done) => setTimeout(done, wait * 1000));
  res = await fetch(`${BASE}/v1/jobs/${job.id}`);
  job = await res.json();
}
if (job.status === "failed") throw new Error(job.error.code);

const image = await fetch(BASE + job.result.image_url);
const png = Buffer.from(await image.arrayBuffer());
await writeFile("tile-seamless.png", png);
```

## What does a fix cost?

A fix costs credits, which come with a Pro plan; the check is free.
[Credits and plans](https://makeseamless.com/docs/credits-and-plans.md) has the numbers.

## Next steps

> [card] [The seam report](https://makeseamless.com/docs/concepts.md)
>
> Repeat types, verdicts and visible change.

> [card] [Fix and jobs](https://makeseamless.com/docs/fix-and-jobs.md)
>
> Stages, results, other images, ratings.

> [card] [Errors](https://makeseamless.com/docs/errors.md)
>
> Every code and when a retry helps.

> [card] [Connect an agent](https://makeseamless.com/docs/connect-an-agent.md)
>
> Let an agent run these calls for you.


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