> For the complete documentation index, see [llms.txt](https://croplink.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://croplink.gitbook.io/docs/api-reference/mirror.md).

# Mirror

**`campaign/{campaign}/mirror`**, where **`{campaign}`** is a placeholder representing the campaign ID.

### Request example:

{% tabs %}
{% tab title="cURL" %}

```
curl -X POST 'https://api.croplink.net/public/v1/mirror/campaign/1/mirror' \
--header 'Authorization: Bearer [yourAuthKey]' \
--header 'Content-Type: application/json' \
--data '{
  "mirror_endpoint": "https://your-mirror.com"
}'
```

{% endtab %}
{% endtabs %}

{% code title="Example response" overflow="wrap" lineNumbers="true" %}

```json5
{
   "mirror": {
        "id": 1,
        "campaign_id": 1,
        "target_url": "https://your-mirror.com",
        "clicks": 0,
        "updated_externally": true,
        "updated_externally_at": "2025-01-27T17:39:41.000000Z",
        "created_at": "2025-01-27T17:39:35.000000Z",
        "updated_at": "2025-01-27T17:39:41.000000Z"
    }
}
```

{% endcode %}

#### Request Body Descriptions <a href="#request-body-descriptions" id="request-body-descriptions"></a>

| Body parameter                | Description          |
| ----------------------------- | -------------------- |
| mirror\_endpoint *(required)* | Mirror to be setted. |

#### Error Responses

Make sure to check [common errors](/docs/best-practices/error-handling.md) before.

<table data-full-width="true"><thead><tr><th width="140">HTTP code</th><th width="471">Response body</th><th>Description</th></tr></thead><tbody><tr><td>404</td><td><pre class="language-json"><code class="lang-json">{
    "message": "No query results for model [App\\Models\\Campaign] 1"
}
</code></pre></td><td>The campaign with the specified ID in the URL: campaign/{campaign}/mirror could not be found.</td></tr><tr><td>403</td><td><pre class="language-json"><code class="lang-json">{
    "message": "This action is unauthorized."
}
</code></pre></td><td>One potential reason:<br>- Before updating the mirror, ensure that <strong>it's created</strong> in the settings.<br><br>- The mirror <strong>cannot</strong> be updated <strong>for the default campaign</strong>.<br><br>- <strong>You</strong> must be <strong>the owner of the campaign</strong> to proceed.</td></tr><tr><td>422</td><td><pre class="language-json"><code class="lang-json"><strong>{
</strong><strong>    "message": "The mirror endpoint field is required.",
</strong>    "errors": {
        "mirror_endpoint": [
            "The mirror endpoint field is required."
        ]
    }
}
</code></pre></td><td>Validation error.</td></tr></tbody></table>
