# Add or update a metadata

This service allows you to add or update custom metadata to a user, such as driving indicators that have been calculated in your backend.

You can add as many metadata as you need in a key-value format.

Metadata can be synchronized in the mobile application and displayed to the user.

{% hint style="info" %}
If you have your **admin API key**, you can try the API via this [**link**](https://drivequant.stoplight.io/docs/drivequant-public/859e608696efa-add-or-update-metadata-to-a-driver).
{% endhint %}

{% openapi src="/files/vFAk3JguKVX7puZ4T9le" path="/drivekit/admin/drivers/{userId}/metadata" method="put" %}
[driver-metadata.yaml](https://2525923625-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXYIG5U3AO65YYFWJRK%2Fuploads%2FiJLlphV8KgW8vXmxhU6z%2Fdriver-metadata.yaml?alt=media\&token=c9240eba-618e-4020-9848-61e2dac658c4)
{% endopenapi %}

## Use case: custom scores

Custom scores can be calculated over a specific period of time (policy year, calendar year, 12 months rolling period...) using the individual scores of the trips made during this period, or using timelines.

If a customer has calculated one (or more) custom score(s) for a driver, this service can be used to attach this metadata to the driver. These scores can then be displayed to the user in the mobile app, and can be linked to a reward or a discount on an insurance premium.

Scores can be added one at a time or, more effectively, all at once:

{% tabs %}
{% tab title="Adding one score" %}

<pre class="language-json" data-title="JSON body (request)"><code class="lang-json">{
<strong>   "metaData" : {
</strong>     "annualSafetyScore" : "8.9"
   }
}
</code></pre>

{% endtab %}

{% tab title="Adding several scores" %}

<pre class="language-json" data-title="JSON body (request)"><code class="lang-json">{
<strong>   "metaData" : {
</strong>      "annualSafetyScore" : "8.9",
      "annualDistractionScore" : "9.8"
      "monthlyCustomScore": "8.1"
   }
}
</code></pre>

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Scores can also be updated using the same service, providing a new value for the same key. This can be used for the driver to have a regular update on his/her progress.

**Example:**

1. First, set the driver's score to 9.8:\
   `{"metaData":{"monthlyCustomScore": "9.8"}}`&#x20;
2. Then, set it to 8.7:\
   `{"metaData":{"monthlyCustomScore": "8.7"}}`&#x20;
   {% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.drivequant.com/backend/driver/add-or-update-a-metadata.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
