# Metadata

Add extra information to your Push Notifications and Live Activities.

Attach details such as a customer ID or job result as metadata. You can view them in ActivitySmith on iOS or the web by opening a Push Notification or Live Activity detail. Metadata does not appear in the Push Notification or Live Activity shown on your Lock Screen.

![Push Notification detail showing metadata in ActivitySmith for iOS](https://cdn.activitysmith.com/features/metadata-ios.png)

## Add metadata

Include a top-level `metadata` object when sending a Push Notification or Live Activity.

```js Node
await activitysmith.notifications.send({
  title: "New subscription",
  message: "Customer upgraded to Pro plan",
  metadata: {
    customer_id: "382",
    plan: "Pro",
    amount: 29,
    trial: false,
  },
});
```

```python Python
activitysmith.notifications.send(
    title="New subscription",
    message="Customer upgraded to Pro plan",
    metadata={
        "customer_id": "382",
        "plan": "Pro",
        "amount": 29,
        "trial": False,
    },
)
```

```go Go
activitysmith.Notifications.Send(activitysmithsdk.PushNotificationInput{
    Title: "New subscription",
    Message: "Customer upgraded to Pro plan",
    Metadata: map[string]any{
        "customer_id": "382",
        "plan": "Pro",
        "amount": 29,
        "trial": false,
    },
})
```

```php PHP
$activitysmith->notifications->send(
    title: 'New subscription',
    message: 'Customer upgraded to Pro plan',
    metadata: [
        'customer_id' => '382',
        'plan' => 'Pro',
        'amount' => 29,
        'trial' => false,
    ],
);
```

```ruby Ruby
activitysmith.notifications.send(
  title: "New subscription",
  message: "Customer upgraded to Pro plan",
  metadata: {
    customer_id: "382",
    plan: "Pro",
    amount: 29,
    trial: false,
  }
)
```

```bash CLI
activitysmith push \
  --title "New subscription" \
  --message "Customer upgraded to Pro plan" \
  --metadata '{
    "customer_id": "382",
    "plan": "Pro",
    "amount": 29,
    "trial": false
  }'
```

```bash cURL
curl -X POST https://activitysmith.com/api/push-notification \
  -H "Authorization: Bearer $YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "New subscription",
    "message": "Customer upgraded to Pro plan",
    "metadata": {
      "customer_id": "382",
      "plan": "Pro",
      "amount": 29,
      "trial": false
    }
  }'
```

## Update or clear metadata

When updating or ending a Live Activity:

- Omit `metadata` to keep the existing fields.
- Send a `metadata` object to replace all existing fields. Include every field you want to keep.
- Send `"metadata": {}` to clear all fields.

These rules apply to managed streams and the legacy start, update, and end endpoints when they update an existing activity.

## Supported values and limits

| Property | Limit |
| --- | --- |
| Fields | Up to 50 entries |
| Field names | 1 to 100 characters, cannot be blank or `__proto__` |
| String values | Up to 4,000 characters |
| Number values | Finite numbers |
| Boolean values | `true` or `false` |
| Total size | Up to 16 KB of serialized UTF-8 JSON |

Nested objects, arrays, and `null` values are not supported.
