> ## Documentation Index
> Fetch the complete documentation index at: https://velt-mintlify-e6426361.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Update activity logs (v2)

> Modify existing activity log records within an organization using the Velt v2 REST API to amend metadata, payloads, or labels on past audit events.

Use this API to update existing activity log records within an organization.

# Endpoint

`POST https://api.velt.dev/v2/activities/update`

# Headers

<ParamField header="x-velt-api-key" type="string" required>
  Your API key.
</ParamField>

<ParamField header="x-velt-auth-token" type="string" required>
  Your [Auth Token](/security/auth-tokens).
</ParamField>

# Body

#### Params

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="organizationId" type="string" required>
      Organization ID
    </ParamField>

    <ParamField body="activities" type="object[]" required>
      Array of activity log objects to update. Each must include the activity log `id`.

      <Expandable title="properties">
        <ParamField body="id" type="string" required>
          Activity log ID to update.
        </ParamField>

        <ParamField body="changes" type="object">
          Map of field names to `{ from, to }` objects describing what changed.
        </ParamField>

        <ParamField body="entityData" type="any">
          Updated snapshot of the entity.
        </ParamField>

        <ParamField body="entityTargetData" type="any">
          Updated snapshot of the target entity.
        </ParamField>

        <ParamField body="displayMessageTemplate" type="string">
          Updated message template string. Use `{{variable}}` syntax for dynamic values.
        </ParamField>

        <ParamField body="displayMessageTemplateData" type="object">
          Updated key-value data to populate `displayMessageTemplate` variables.
        </ParamField>

        <ParamField body="actionIcon" type="string">
          Updated URL or identifier for the action icon.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

## **Example Requests**

#### Update a single activity log's display message

```JSON theme={null}
{
  "data": {
    "organizationId": "org-123",
    "activities": [
      {
        "id": "activity-001",
        "displayMessageTemplate": "{{user}} updated the comment"
      }
    ]
  }
}
```

#### Update multiple activities

```JSON theme={null}
{
  "data": {
    "organizationId": "org-123",
    "activities": [
      {
        "id": "activity-001",
        "displayMessageTemplate": "{{user}} updated the comment",
        "displayMessageTemplateData": {
          "user": {
            "userId": "user-1",
            "name": "User Name"
          }
        }
      },
      {
        "id": "activity-002",
        "actionIcon": "https://example.com/icons/edit.svg"
      }
    ]
  }
}
```

# Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Activity(s) updated successfully.",
    "data": {
      "activity-001": {
        "success": true,
        "message": "Activity updated."
      }
    }
  }
}
```

#### When some activities are not found

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Activity(s) updated successfully.",
    "data": {
      "activity-001": {
        "success": false,
        "message": "Failed to update activity."
      },
      "activity-002": {
        "success": true,
        "message": "Activity updated."
      }
    }
  }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
```

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "success",
      "message": "Activity(s) updated successfully.",
      "data": {
        "activity-001": {
          "success": true,
          "message": "Activity updated."
        }
      }
    }
  }
  ```
</ResponseExample>
