# Metadata

The Trustap API transaction supports a metadata field.

Today, metadata is only supported for face-to-face transactions.

* The metadata field stores key-value pairs in a JSON format.
* You can store up to 100 key-value pairs.
* The maximum length of each JSON key is 40 characters and each JSON value is 100 characters.
* Only strings are supported.


If you exceed your 100 key-value pairs, you will receive an error `too_many_metadata_fields`.

## Add metadata to an existing transaction

Metadata can only be added to existing transactions. In this example, the transaction ID is `23860`.

Add metadata

```CURL
curl --location 'https://dev.stage.trustap.com/api/v1/p2p/transactions/23860/metadata' \
--header 'Content-Type: application/json' \
--user '<API_KEY>:' \
--data-raw '{"customer_url":"https://my-bike-parts.com/","part_number":"98932"}'
```

Response

```JSON
{
    "customer_url": "https://my-bike-parts.com/",
    "part_number": "98932"
}
```

## Read metadata

Use the transaction ID in your path to retrieve the metadata for that transaction.

Read metadata

```CURL
curl --location 'https://dev.stage.trustap.com/api/v1/p2p/transactions/23860/metadata' \
--user '<API_KEY>:'
```

Response

```JSON
{
    "customer_url": "https://my-bike-parts.com/",
    "part_number": "98932"
}
```

## Update metadata

You cannot delete a metadata entry but you can update an existing entry.
You can add additional key-value pairs without overwriting existing metadata up to the maximum of 100 key-value pairs.
The Trustap API supports updating existing values and adding new key-value pairs in the same call.

Update metadata

```CURL
 curl --location 'https://dev.stage.trustap.com/api/v1/p2p/transactions/23860/metadata' \
--header 'Content-Type: application/json' \
--user '<API_KEY>:' \
--data-raw '{"part_number":"44432","transaction_date":"12/09/2025"}'
```

Response

```JSON
{
    "customer_url": "https://my-bike-parts.com/",
    "part_number": "44432",
    "transaction_date": "12/09/2025"
}
```