# Change a garment's texture

> Change the texture, print and colour of one garment in a finished image to match a fabric, keeping the person, the pose and the scene. Delivered as one image file.

**Endpoint:** `POST https://api.refabric.com/v1/tasks/image.change_texture` · **Task:** `image.change_texture` · **Scope:** `tasks:run` · **Category:** Image editing

Send a finished image, a fabric — a photo of it or one from your fabric library — and a sentence naming the garment. That garment takes on the fabric's texture, print and colour, while the person, the pose and the scene stay.

## Quick start

```python
import os
import time
import requests

headers = {"Authorization": f"Key {os.environ['REFABRIC_API_KEY']}"}

job = requests.post(
    "https://api.refabric.com/v1/tasks/image.change_texture",
    headers=headers,
    json={
        "image": "art:9f2c01",
        "fabric": "fabric:5f0c1d2e-8a41-4b7e-9c3d-1a2b3c4d5e60",
        "prompt": "the knit should be the ribbed cream one, not flat white",
    },
).json()
print(job["job_id"])

while True:
    status = requests.get(job["status_url"], headers=headers).json()
    if status["lifecycle"] == "terminal":
        break
    time.sleep(5)

print(requests.get(job["result_url"], headers=headers).json())
```

```javascript
const headers = {
  Authorization: `Key ${process.env.REFABRIC_API_KEY}`,
  "Content-Type": "application/json",
};

const job = await fetch("https://api.refabric.com/v1/tasks/image.change_texture", {
  method: "POST",
  headers,
  body: JSON.stringify({
    "image": "art:9f2c01",
    "fabric": "fabric:5f0c1d2e-8a41-4b7e-9c3d-1a2b3c4d5e60",
    "prompt": "the knit should be the ribbed cream one, not flat white"
  }),
}).then((r) => r.json());
console.log(job.job_id);

let status = job;
while (status.lifecycle !== "terminal") {
  await new Promise((r) => setTimeout(r, 5000));
  status = await fetch(job.status_url, { headers }).then((r) => r.json());
}

console.log(await fetch(job.result_url, { headers }).then((r) => r.json()));
```

```bash
curl -X POST "https://api.refabric.com/v1/tasks/image.change_texture" \
  -H "Authorization: Key $REFABRIC_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Prefer: wait=60" \
  -d '{"image":"art:9f2c01","fabric":"fabric:5f0c1d2e-8a41-4b7e-9c3d-1a2b3c4d5e60","prompt":"the knit should be the ribbed cream one, not flat white"}'
```

## Input schema

- `image` (string, _required_, pattern: ^(https://|art:|file:).+$) — The finished image to change, as one string: a URL, a file from an earlier result (`art:…` or its url) or an upload (`file:…`). Any image of a dressed person or a garment; the person, pose and scene come back unchanged. If it is one of your files placed in a project in the Refabric app, the result is filed there too.
  Example: `art:9f2c01`
- `fabric` (string, _required_, pattern: ^(https://|art:|file:|fabric:).+$) — The fabric to match — its texture, print and colour — as one string: a photo of it (a full `https://` URL, `art:…` or `file:…`, or an `items[].url` of a fabric's `data`), or a library fabric `fabric:<id>` (`GET /v1/refs/fabric`), whose cover image is used. Send a publicly reachable image.
  Example: `fabric:5f0c1d2e-8a41-4b7e-9c3d-1a2b3c4d5e60`
- `prompt` (string, _required_, min length 1, max length 2000) — What to change, in any language, up to 2000 characters — name the garment when the image shows several ("the red t-shirt should be the ribbed cream knit").
  Example: `the knit should be the ribbed cream one, not flat white`

## Required-fields example

```json
{
  "image": "art:9f2c01",
  "fabric": "fabric:5f0c1d2e-8a41-4b7e-9c3d-1a2b3c4d5e60",
  "prompt": "the knit should be the ribbed cream one, not flat white"
}
```

## Full example

```json
{
  "image": "art:9f2c01",
  "fabric": "fabric:5f0c1d2e-8a41-4b7e-9c3d-1a2b3c4d5e60",
  "prompt": "the knit should be the ribbed cream one, not flat white"
}
```

## Output schema

- `files` (array<object>, _optional_) — One `image/*` file: the image with the garment's texture, print and colour changed. Pass it on to another edit to continue from it.

## Response example

```json
{
  "job_id": "d2b3c4d500004000800000000000000a",
  "lifecycle": "queued",
  "status_url": "http://v3-api.refabric.com/v1/jobs/d2b3c4d500004000800000000000000a",
  "result_url": "http://v3-api.refabric.com/v1/jobs/d2b3c4d500004000800000000000000a/result",
  "cancel_url": "http://v3-api.refabric.com/v1/jobs/d2b3c4d500004000800000000000000a/cancel"
}
```

## Result example

```json
{
  "job_id": "d2b3c4d500004000800000000000000a",
  "files": [
    {
      "file": "art:9f2c02",
      "url": "https://files.example.com/image.change_texture/1.png",
      "media_type": "image/png",
      "task": "image.change_texture",
      "job_id": "d2b3c4d500004000800000000000000a",
      "created_at": "2026-09-30T11:04:52Z"
    }
  ],
  "has_more": false
}
```

The fabric handle stands for the fabric's cover image; a fabric photo url, `art:` or `file:` works the same. The image is one of your products, so the result is saved on that product too.

## Built for

- A design shown in another fabric
- A shoot image matched to the fabric you will produce in
- Fabric options compared on one image

## What you get

- One image with the garment's texture, print and colour changed to the fabric's.

## Prompting

Say what to change and name the garment when the image shows several ('the red t-shirt should be the ribbed cream knit'). Any language works.

## Specs

- **Input formats:** Images, each one string: a URL, an upload (`file:…`) or a file from an earlier result (`art:…`). Upload types and sizes: `GET /v1/meta` `limits.upload`.
- **Input count:** `image`: one; `fabric`: one
- **Output format:** Files: each one line with its `url` and its `media_type`, in the job's result.
- **Outputs per job:** One image file per job.

## Choosing a task

- Use this when a garment should take on the texture, print and colour of a fabric you have. Use `image.glam` when a small detail should change: make-up, a button, jewellery.

## Errors

- `field_not_accepted`
- `invalid_request`
- `request_refused`
- `not_found`
- `permission_denied`
- `insufficient_credits`
- `processing_failed`

## Related

- `fabric.create` — It runs before: its result is this input.
- `photoshoot.create` — It runs before: its result is this input.
- `image.upscale` — It runs after: it takes this task's result.

## Good to know

- `prompt` is at most 2000 characters.

## For agents and code generation

- https://api.refabric.com/v1/tasks/image.change_texture/llms.txt
- https://api.refabric.com/v1/tasks/image.change_texture/openapi.json
- GET https://api.refabric.com/v1/tasks/image.change_texture
