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

# Update Event

> Update fields on an existing event

## Overview

This endpoint updates fields on an event that Cometly has already ingested. It uses **sparse PUT** semantics: fields you include are replaced, fields you omit are left as they are. At least one updatable field must be provided.

Currently `amount` is the updatable field.

## Path Parameters

<ParamField path="event_id" type="integer" required>
  The unique identifier of the event to update — the same `id` returned by [List Events](/api-reference/endpoint/list-events) or [Get Event](/api-reference/endpoint/get-event).
</ParamField>

## Request Body

<ParamField body="amount" type="number | null">
  The new transaction amount. Must be `0` or greater. Numeric strings such as `"120.25"` are accepted. Sending `null` clears the amount.
</ParamField>

## Response

### Success Response

<ResponseField name="message" type="string">
  Confirmation message, e.g. `"Event updated successfully"`
</ResponseField>

### Error Response

<ResponseField name="message" type="string">
  Error description explaining what went wrong
</ResponseField>

## Example Requests

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT https://app.cometly.com/public-api/v1/events/123456 \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{
      "amount": 49.50
    }'
  ```

  ```javascript JavaScript theme={null}
  const eventId = '123456';
  const response = await fetch(`https://app.cometly.com/public-api/v1/events/${eventId}`, {
    method: 'PUT',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      amount: 49.50
    })
  });

  const data = await response.json();
  console.log(data.message); // "Event updated successfully"
  ```

  ```php PHP theme={null}
  <?php
  $eventId = '123456';
  $url = 'https://app.cometly.com/public-api/v1/events/' . $eventId;
  $headers = [
      'Authorization: Bearer YOUR_API_KEY',
      'Accept: application/json',
      'Content-Type: application/json'
  ];

  $data = [
      'amount' => 49.50,
  ];

  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
  curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

  $response = curl_exec($ch);
  $result = json_decode($response, true);
  curl_close($ch);
  ?>
  ```

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

  event_id = '123456'
  url = f'https://app.cometly.com/public-api/v1/events/{event_id}'
  headers = {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Accept': 'application/json',
      'Content-Type': 'application/json'
  }

  data = {
      'amount': 49.50,
  }

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

## Status Codes

| Status Code | Description                                                                               |
| ----------- | ----------------------------------------------------------------------------------------- |
| 200         | Event successfully updated                                                                |
| 401         | Missing or invalid API key                                                                |
| 403         | API key doesn't have permission or subscription is inactive                               |
| 404         | Event not found in this Space                                                             |
| 422         | Invalid parameters provided (check error message for details)                             |
| 429         | Too many requests - rate limit exceeded. See [Rate Limiting](/introduction/rate-limiting) |

## Notes

* **Rate Limit**: This endpoint has a limit of **60 requests per minute** per Space. See [Rate Limiting](/introduction/rate-limiting) for details.
* **Unknown fields** in the request body are ignored.
