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

> ## Agent Instructions
> The base URL is https://api.sudomock.com.
> Authenticate every request with the x-api-key header. Keys begin with sm_.
> A render returns the finished image at data.print_files[0].export_path. A request sent with is_async true returns a job_id to poll at GET /api/v1/jobs/{job_id}.
> Prefer the official SDKs over hand-written HTTP calls: npm install sudomock for Node, pip install sudomock for Python.

# Fix the seams of a pattern tile

> Makes a pattern tile repeat without a visible line where its copies meet, keeping its width and height. Runs as a job: poll GET /api/v1/jobs/{job_id}, or receive the seam_fix.succeeded webhook. Costs 60 credits, refunded when the fix fails. A tile with transparent edges, or one larger than a fix takes, is refused and nothing is charged. Send crop_aspect when the render places the tile with fit "crop".

Repairs a tile so its copies meet without a visible line, and returns a job.
The body is the same as [Check seams](https://sudomock.com/docs/api-reference/patterns/check-seams.md): the
tile as `url` or `base64`, and `crop_aspect` when the render will crop it. The
call answers `202` with a `job_id` and `kind` set to `seam_fix`. Follow the job
with [Retrieve a single job](https://sudomock.com/docs/api-reference/jobs/retrieve-a-single-job.md), or
take the `seam_fix.succeeded` [webhook](https://sudomock.com/docs/webhooks/overview.md).

A fix costs 60 credits. They are taken when the job is accepted and returned
in full when it fails. Send an `Idempotency-Key` header and reuse it only to
retry the same request, so a retry after a timeout returns the first job
instead of starting a second one.

A tile can be fixed up to 3,500 px on each side. A larger tile answers
`ARTWORK_DIMENSIONS_TOO_LARGE` with the limit in `details.max_edge`, and a tile
with transparent pixels along its edges answers `422` with
`TILE_HAS_TRANSPARENT_EDGES`. Neither is charged. Run
[Check seams](https://sudomock.com/docs/api-reference/patterns/check-seams.md) first and read `fixable` to
know before you send.

While the job runs, `stage` moves forward through `queued`, `fixing` and
`finishing`. The finished job carries:

| Field | What it holds |
| - | - |
| `result_url` | The repaired tile as a PNG. |
| `alternative_url` | A second repair that also passed, or `null`. |
| `result_status` | A free check of the result: `seamless`, `faint_seam` or `visible_seam`. |
| `changes` | `edges` when only the area around the joins changed, `whole_tile` when the tile was rebuilt as a whole and fine detail can look softer. |

A job that fails answers `TILE_NOT_FIXABLE` when the image does not repeat as a
tile or no repair of it came out clean, or `SEAM_FIX_FAILED` when the fix could
not be finished and is worth trying again. On `TILE_NOT_FIXABLE`,
`details.reason` is `not_a_pattern_tile` or `no_clean_result`. Both return the
credits. The repaired files are kept, and a later
check of the same tile hands them back in `previous_fix`.

```js Node.js theme={"theme":{"light":"github-light","dark":"vesper"}}
const response = await fetch("https://api.sudomock.com/api/v1/fix-seams", {
  method: "POST",
  headers: {
    "x-api-key": "sm_your_api_key",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "url": "https://example.com/pattern-tile.png"
  }),
});

const data = await response.json();
console.log(data);
```

```php PHP theme={"theme":{"light":"github-light","dark":"vesper"}}
<?php

$payload = <<<'JSON'
{
  "url": "https://example.com/pattern-tile.png"
}
JSON;

$ch = curl_init("https://api.sudomock.com/api/v1/fix-seams");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "x-api-key: sm_your_api_key",
    "Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
```

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

payload = {'url': 'https://example.com/pattern-tile.png'}

response = requests.post(
    "https://api.sudomock.com/api/v1/fix-seams",
    headers={"x-api-key": "sm_your_api_key"},
    json=payload,
)

response.raise_for_status()
print(response.json())
```

```ruby Ruby theme={"theme":{"light":"github-light","dark":"vesper"}}
require "net/http"
require "uri"

uri = URI("https://api.sudomock.com/api/v1/fix-seams")
request = Net::HTTP::Post.new(uri)
request["x-api-key"] = "sm_your_api_key"
request["Content-Type"] = "application/json"

request.body = <<~JSON
  {
    "url": "https://example.com/pattern-tile.png"
  }
JSON

response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts response.body
```

```go Go theme={"theme":{"light":"github-light","dark":"vesper"}}
package main

import (
	"bytes"
	"fmt"
	"io"
	"net/http"
)

func main() {
	payload := []byte(`{
  "url": "https://example.com/pattern-tile.png"
}`)

	req, err := http.NewRequest("POST", "https://api.sudomock.com/api/v1/fix-seams", bytes.NewBuffer(payload))
	if err != nil {
		panic(err)
	}
	req.Header.Set("x-api-key", "sm_your_api_key")
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	body, _ := io.ReadAll(res.Body)
	fmt.Println(string(body))
}
```

```java Java theme={"theme":{"light":"github-light","dark":"vesper"}}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

String payload = """
{
  "url": "https://example.com/pattern-tile.png"
}
""";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.sudomock.com/api/v1/fix-seams"))
    .header("x-api-key", "sm_your_api_key")
    .header("Content-Type", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString(payload))
    .build();

HttpResponse<String> response = HttpClient.newHttpClient()
    .send(request, HttpResponse.BodyHandlers.ofString());

System.out.println(response.body());
```

```csharp .NET theme={"theme":{"light":"github-light","dark":"vesper"}}
using System.Net.Http;
using System.Text;

var payload = """
{
  "url": "https://example.com/pattern-tile.png"
}
""";

var request = new HttpRequestMessage(HttpMethod.Post, "https://api.sudomock.com/api/v1/fix-seams");
request.Headers.Add("x-api-key", "sm_your_api_key");
request.Content = new StringContent(payload, Encoding.UTF8, "application/json");

var client = new HttpClient();
var response = await client.SendAsync(request);

Console.WriteLine(await response.Content.ReadAsStringAsync());
```

```bash cURL theme={"theme":{"light":"github-light","dark":"vesper"}}
curl -X POST "https://api.sudomock.com/api/v1/fix-seams" \
  -H "x-api-key: sm_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/pattern-tile.png"
  }'
```

```json Response theme={"theme":{"light":"github-light","dark":"vesper"}}
{
  "job_id": "5f1c0b2a-7d43-4e9a-8c16-0b5d3f7a2e94",
  "kind": "seam_fix",
  "status": "queued",
  "status_url": "/api/v1/jobs/5f1c0b2a-7d43-4e9a-8c16-0b5d3f7a2e94"
}
```


## OpenAPI

````yaml openapi.json POST /api/v1/fix-seams
openapi: 3.1.0
info:
  title: SudoMock API
  description: >-
    Product mockup API. Render PSD templates, turn product photos into reusable
    mockups, create still images and videos, personalize text with fonts, and
    manage asynchronous jobs and signed webhooks.


    Every endpoint answers failures with the same envelope, so the status codes,
    the error_code values and the retry rule are documented once at
    https://sudomock.com/docs/errors rather than repeated per operation.
  version: 1.0.0
servers:
  - url: https://api.sudomock.com
    description: Production
security: []
tags:
  - name: PSD mockups
    description: Turn a Photoshop file into a reusable mockup, then render it.
  - name: Photo mockups
    description: Turn a product photo into a reusable mockup, then render artwork onto it.
  - name: Video mockups
    description: Render a mockup as a short video.
  - name: Fonts
    description: Upload and manage the fonts available to text layers.
  - name: Background removal
    description: Isolate a subject from its background as a standalone step.
  - name: Patterns
    description: Check a repeating pattern tile for seams and fix them.
  - name: Studio
    description: Open an embedded editor session and read what the customer produced in it.
  - name: Webhook endpoints
    description: Register signed endpoints and manage their secrets.
  - name: Webhook deliveries
    description: Inspect, replay and retry what those endpoints received.
  - name: Jobs
    description: Poll queued renders and read their results.
  - name: Account
    description: Read the current account, its plan and its remaining credits.
paths:
  /api/v1/fix-seams:
    post:
      tags:
        - Patterns
      summary: Fix the seams of a pattern tile
      description: >-
        Makes a pattern tile repeat without a visible line where its copies
        meet, keeping its width and height. Runs as a job: poll GET
        /api/v1/jobs/{job_id}, or receive the seam_fix.succeeded webhook. Costs
        60 credits, refunded when the fix fails. A tile with transparent edges,
        or one larger than a fix takes, is refused and nothing is charged. Send
        crop_aspect when the render places the tile with fit "crop".
      operationId: fix_seams_api_v1_fix_seams_post
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
            description: >-
              Optional. A key you choose for this request, up to 255 characters.
              A retry with the same key returns the same job and is not charged
              again.
          description: >-
            Optional. A key you choose for this request, up to 255 characters. A
            retry with the same key returns the same job and is not charged
            again.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SeamFixRequest'
      responses:
        '202':
          description: Fix queued. Poll status_url for the result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobAcceptedResponse'
              example:
                job_id: 5f1c0b2a-7d43-4e9a-8c16-0b5d3f7a2e94
                kind: seam_fix
                status: queued
                status_url: /api/v1/jobs/5f1c0b2a-7d43-4e9a-8c16-0b5d3f7a2e94
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: Node.js
          source: >-
            const response = await
            fetch("https://api.sudomock.com/api/v1/fix-seams", {
              method: "POST",
              headers: {
                "x-api-key": "sm_your_api_key",
                "Content-Type": "application/json",
              },
              body: JSON.stringify({
                "url": "https://example.com/pattern-tile.png"
              }),
            });


            const data = await response.json();

            console.log(data);
        - lang: PHP
          source: |-
            <?php

            $payload = <<<'JSON'
            {
              "url": "https://example.com/pattern-tile.png"
            }
            JSON;

            $ch = curl_init("https://api.sudomock.com/api/v1/fix-seams");
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, [
                "x-api-key: sm_your_api_key",
                "Content-Type: application/json",
            ]);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);

            $response = curl_exec($ch);
            curl_close($ch);

            echo $response;
        - lang: Python
          source: |-
            import requests

            payload = {'url': 'https://example.com/pattern-tile.png'}

            response = requests.post(
                "https://api.sudomock.com/api/v1/fix-seams",
                headers={"x-api-key": "sm_your_api_key"},
                json=payload,
            )

            response.raise_for_status()
            print(response.json())
        - lang: Ruby
          source: >-
            require "net/http"

            require "uri"


            uri = URI("https://api.sudomock.com/api/v1/fix-seams")

            request = Net::HTTP::Post.new(uri)

            request["x-api-key"] = "sm_your_api_key"

            request["Content-Type"] = "application/json"


            request.body = <<~JSON
              {
                "url": "https://example.com/pattern-tile.png"
              }
            JSON


            response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do
            |http|
              http.request(request)
            end


            puts response.body
        - lang: Go
          source: "package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tpayload := []byte(`{\n  \"url\": \"https://example.com/pattern-tile.png\"\n}`)\n\n\treq, err := http.NewRequest(\"POST\", \"https://api.sudomock.com/api/v1/fix-seams\", bytes.NewBuffer(payload))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treq.Header.Set(\"x-api-key\", \"sm_your_api_key\")\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer res.Body.Close()\n\n\tbody, _ := io.ReadAll(res.Body)\n\tfmt.Println(string(body))\n}"
        - lang: Java
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;

            String payload = """
            {
              "url": "https://example.com/pattern-tile.png"
            }
            """;

            HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create("https://api.sudomock.com/api/v1/fix-seams"))
                .header("x-api-key", "sm_your_api_key")
                .header("Content-Type", "application/json")
                .POST(HttpRequest.BodyPublishers.ofString(payload))
                .build();

            HttpResponse<String> response = HttpClient.newHttpClient()
                .send(request, HttpResponse.BodyHandlers.ofString());

            System.out.println(response.body());
        - lang: .NET
          source: >-
            using System.Net.Http;

            using System.Text;


            var payload = """

            {
              "url": "https://example.com/pattern-tile.png"
            }

            """;


            var request = new HttpRequestMessage(HttpMethod.Post,
            "https://api.sudomock.com/api/v1/fix-seams");

            request.Headers.Add("x-api-key", "sm_your_api_key");

            request.Content = new StringContent(payload, Encoding.UTF8,
            "application/json");


            var client = new HttpClient();

            var response = await client.SendAsync(request);


            Console.WriteLine(await response.Content.ReadAsStringAsync());
        - lang: cURL
          source: |-
            curl -X POST "https://api.sudomock.com/api/v1/fix-seams" \
              -H "x-api-key: sm_your_api_key" \
              -H "Content-Type: application/json" \
              -d '{
                "url": "https://example.com/pattern-tile.png"
              }'
components:
  schemas:
    SeamFixRequest:
      properties:
        url:
          anyOf:
            - type: string
            - type: 'null'
          description: URL of the tile image (HTTP/HTTPS). Send either url or base64.
        base64:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Raw base64-encoded image bytes (no data: prefix). Send either url or
            base64.
        content_type:
          anyOf:
            - type: string
              pattern: ^image/(png|jpeg|webp|gif)$
            - type: 'null'
          description: >-
            Optional. The file type is detected from the image itself, so this
            field can be left out.
        crop_aspect:
          anyOf:
            - type: number
              exclusiveMinimum: 0
            - type: 'null'
          description: >-
            Optional. Width divided by height of the tile when the render places
            the artwork with fit "crop". The image is cut exactly as that render
            cuts it, then fixed. Leave it out to fix the whole image.
      additionalProperties: false
      type: object
      title: SeamFixRequest
      description: |-
        Body for POST /api/v1/fix-seams: the same fields as a seam check. The
        tile is fixed exactly as the check sees it, crop included.
      example:
        url: https://example.com/pattern-tile.png
    JobAcceptedResponse:
      properties:
        job_id:
          type: string
          description: Identifier of the queued job, used to poll its status.
          examples:
            - 5f1c0b2a-7d43-4e9a-8c16-0b5d3f7a2e94
        kind:
          type: string
          description: >-
            The kind of work accepted: render, upload, photo_mockup_render or
            seam_fix.
          examples:
            - render
        status:
          type: string
          description: State of the job when this response was returned, usually queued.
          examples:
            - queued
        status_url:
          type: string
          description: Path to poll for this job's status.
          examples:
            - /api/v1/jobs/5f1c0b2a-7d43-4e9a-8c16-0b5d3f7a2e94
      type: object
      required:
        - job_id
        - kind
        - status
        - status_url
      title: JobAcceptedResponse
      description: Acknowledgement that an async request was accepted as a job.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key with sm_ prefix. Get your key at
        https://sudomock.com/dashboard/api-keys

````

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