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

# Update Link Status

> Update the status of a dynamic link (activate or pause)

## Request

<ParamField header="X-API-KEY" type="string" required>
  Your project API key: `b2co_your_api_key`
</ParamField>

<ParamField path="code" type="string" required>
  The unique short code of the link to update
</ParamField>

<ParamField body="status" type="string" required>
  New status for the link. Must be either `ACTIVE` or `PAUSED`
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Indicates if the request was successful
</ResponseField>

<ResponseField name="data" type="object">
  The updated link information
</ResponseField>

<ResponseField name="data.message" type="string">
  Success message describing the action performed
</ResponseField>

<ResponseField name="data.id" type="string">
  Unique identifier of the link
</ResponseField>

<ResponseField name="data.code" type="string">
  Unique short code of the link
</ResponseField>

<ResponseField name="data.status" type="string">
  Updated status of the link (ACTIVE or PAUSED)
</ResponseField>

<ResponseField name="data.updatedAt" type="string">
  ISO 8601 timestamp when the link was last updated
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X PUT "https://api.bit2connect.com/1.0/links/summer-sale/status" \
    -H "X-API-KEY: b2co_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{"status": "PAUSED"}'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.bit2connect.com/1.0/links/summer-sale/status",
    {
      method: "PUT",
      headers: {
        "X-API-KEY": "b2co_your_api_key",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        status: "PAUSED",
      }),
    }
  );

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

  ```python Python theme={null}
  import requests

  url = "https://api.bit2connect.com/1.0/links/summer-sale/status"
  headers = {
      "X-API-KEY": "b2co_your_api_key",
      "Content-Type": "application/json"
  }
  payload = {"status": "PAUSED"}

  response = requests.put(url, json=payload, headers=headers)
  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "success": true,
    "data": {
      "message": "Link paused successfully",
      "id": "clp123abc456",
      "code": "summer-sale",
      "status": "PAUSED",
      "updatedAt": "2024-01-15T10:35:00Z"
    }
  }
  ```

  ```json Error Response - Link Already Has Status theme={null}
  {
    "success": false,
    "error": {
      "code": "BAD_REQUEST",
      "message": "Link is already paused"
    }
  }
  ```

  ```json Error Response - Link Not Found theme={null}
  {
    "success": false,
    "error": {
      "code": "LINK_NOT_FOUND",
      "message": "Link not found"
    }
  }
  ```

  ```json Error Response - Invalid Status theme={null}
  {
    "success": false,
    "error": {
      "code": "VALIDATION_ERROR",
      "message": "Invalid status. Must be ACTIVE or PAUSED"
    }
  }
  ```

  ```json Error Response - Expired Link theme={null}
  {
    "success": false,
    "error": {
      "code": "BAD_REQUEST",
      "message": "Cannot activate an expired link"
    }
  }
  ```
</ResponseExample>

## Error Codes

<ResponseField name="VALIDATION_ERROR" type="string">
  Invalid status parameter provided
</ResponseField>

<ResponseField name="LINK_NOT_FOUND" type="string">
  Link with the specified code does not exist or belongs to another project
</ResponseField>

<ResponseField name="INVALID_API_KEY" type="string">
  API key is missing or invalid
</ResponseField>

<ResponseField name="RATE_LIMIT_EXCEEDED" type="string">
  Too many requests, please try again later
</ResponseField>

<ResponseField name="BAD_REQUEST" type="string">
  Link is already in the requested status or operation is not allowed (e.g., activating expired link)
</ResponseField>
