> For the complete documentation index, see [llms.txt](https://docs.predicthq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.predicthq.com/api/loop/loop-links/update-a-loop-link.md).

# Update a Loop Link

Update (replace) an existing Loop Link.

## PUT /v1/loop/links/{link\_id}

> Update (replace) a Loop Link

````json
{"openapi":"3.1.0","info":{"title":"PredictHQ Loop API","version":"1.0.0"},"tags":[{"name":"Loop Links"}],"servers":[{"url":"https://api.predicthq.com"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"$API_KEY","description":"Enter your PredictHQ API key. The Bearer prefix is added automatically.\n\nWhen calling the API directly, send: `Authorization: Bearer <YOUR_API_KEY>` as documented at [https://docs.predicthq.com/api/overview/authenticating](https://docs.predicthq.com/api/overview/authenticating)\n"}},"schemas":{"PublicLinkBody":{"type":"object","properties":{"expire_dt":{"description":"Date/time the Loop Link is set to expire in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.\n\n\nAll dates are in UTC.\n\n\nThis is an optional field - omit if not needed.\n\n\nE.g. `2023-05-08T00:29:45.859Z`","type":"string","format":"date-time","title":"Expire Dt"},"metadata":{"description":"Metadata can be used to further identify Loop Links in a way that makes sense for your system.\n\n\nThe field is a key/value field that accepts string-based keys and string or numeric values.\n\n\nThis can be useful for storing additional data such as a end-user identifier or store ID etc.\n\n\nThis is an optional field - omit if not needed.\n\n\n**E.g.**\n  ```json\n  {\n    \"hotel_id\": \"123456789\"\n  }\n  ```","type":"object","additionalProperties":true,"title":"Metadata"},"name":{"description":"Name of the Loop Link. This is for your own use as a way to differentiate your Loop Links.\n\n\nE.g. `Hotel ABC`","type":"string","maxLength":120,"minLength":1,"pattern":"^[a-zA-Z0-9 _-]+$","title":"Name"}},"title":"PublicLinkBody"},"HTTPValidationError":{"type":"object","properties":{"detail":{"type":"array","items":{"$ref":"#/components/schemas/ValidationError"},"title":"Detail"}},"title":"HTTPValidationError"},"ValidationError":{"type":"object","properties":{"loc":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/loop/links/{link_id}":{"put":{"operationId":"update_link","summary":"Update (replace) a Loop Link","parameters":[{"name":"link_id","in":"path","description":"An existing Loop Link ID.","required":true,"schema":{"type":"string","title":"Link Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicLinkBody"}}}},"responses":{"200":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"tags":["Loop Links"]}}}}
````

## Examples

The following examples update a Loop Link:

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

```bash
curl -X PUT "https://api.predicthq.com/v1/loop/links/$LINK_ID" \
     -H "Accept: application/json" \
     -H "Authorization: Bearer $API_TOKEN" \
     --data @<(cat <<EOF
    {
        "name": "Hotel A",
        "expire_dt": "2024-12-31T00:00:00",
        "metadata": {
            "hotel_id": "123456789"
        }
    }
    EOF
    )
```

{% endtab %}

{% tab title="python" %}

```python
import requests

response = requests.put(
    url="https://api.predicthq.com/v1/loop/links/$LINK_ID",
    headers={
        "Authorization": "Bearer $API_TOKEN",
        "Accept": "application/json"
    },
    json={
        "name": "Hotel A",
        "expire_dt": "2024-12-31T00:00:00",
        "metadata": {
            "hotel_id": "123456789"
        }
    }
)

print(response.status_code)
```

{% endtab %}
{% endtabs %}

## OpenAPI spec

See the [OpenAPI spec for the Loop API](https://api.predicthq.com/docs/?urls.primaryName=Loop+API).

## Guides

ow are some guides relevant to this API:

* [Integrate with Loop Links](/integrations/integration-guides/integrate-with-loop-links.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.predicthq.com/api/loop/loop-links/update-a-loop-link.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
