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

# Update a metric

> Partially update a metric's value, currency, or comment.



## OpenAPI

````yaml patch /metrics/{datum_id}/
openapi: 3.0.1
info:
  title: Standard Metrics API Documentation
  description: >-
    Welcome to Standard Metric's API docs!


    To use our API you will need to make an OAuth appliction (or use an existing
    one) in the developer settings tab on your settings page and then exchange
    your client id and secret for an access token (via the `/o/token/` endpoint.
    This token can then be sent in the `Authorization` header to authenticate
    your requests to our api. See below for an example.


    All endpoints are paginated and will return a maximum of 100 results per
    page. See the endpoints below and example responses for more details on
    pagination parameters. A maximum of 120 requests per minute can be made to
    our API.


    Authentication example (with python):

    ```>>> import base64

    >>> import base64

    >>> client_id = "YOUR_CLIENT_ID"

    >>> client_secret = "YOUR_CLIENT_SECRET"

    >>> credential = f"{client_id}:{client_secret}"

    >>> base64.b64encode(credential.encode("utf-8"))

    b'ENCODED_CREDENTIAL'


    You can now exchange this credential for an access token, eg:


    curl -X POST \
        -H "Authorization: Basic ENCODED_CREDENTIAL" \
        -H "Cache-Control: no-cache" \
        -H "Content-Type: application/x-www-form-urlencoded" \
        "https://api.standardmetrics.io/o/token/" \
        -d "grant_type=client_credentials"

    You will receive the following response:


    {
        "access_token": "YOUR_ACCESS_TOKEN",
        "expires_in": 36000,
        "token_type": "Bearer",
        "scope": "read write"
    }


    Make sure not to forget to prepend "Bearer " to your access token in the
    Authorization header while making requests.
  version: '1.0'
servers:
  - url: https://api.standardmetrics.io/v1
security:
  - Bearer: []
paths:
  /metrics/{datum_id}/:
    patch:
      tags:
        - metrics
      summary: Partially update a Datum's value, currency, or comment.
      description: |-
        Only supplied fields change. `comments` uses the singleton-list shape
        returned by GET `/v1/metrics/`; one item replaces the comment content,
        while an empty content string clears it and omission preserves it.
      operationId: metrics_partial_update
      parameters:
        - name: datum_id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatumPatch'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatumPatchResponse'
components:
  schemas:
    DatumPatch:
      type: object
      properties:
        value:
          title: Value
          minLength: 1
          type: string
        currency:
          title: Currency
          type: string
          enum:
            - AED
            - AUD
            - BDT
            - BRL
            - CAD
            - CHF
            - CNY
            - COP
            - CZK
            - DKK
            - EUR
            - GBP
            - GHS
            - HKD
            - IDR
            - ILS
            - INR
            - JPY
            - JOD
            - KES
            - KRW
            - MXN
            - NGN
            - NOK
            - NZD
            - PEN
            - PHP
            - SAR
            - SGD
            - USD
            - PKR
            - THB
            - TRY
            - TWD
            - TZS
            - VND
            - SEK
            - ISK
            - ZAR
        comments:
          type: array
          items:
            $ref: '#/components/schemas/DatumCommentWrite'
    DatumPatchResponse:
      required:
        - comments
        - currency
        - id
        - value
      type: object
      properties:
        id:
          title: Id
          type: string
        value:
          title: Value
          minLength: 1
          type: string
        currency:
          title: Currency
          type: string
          nullable: true
          enum:
            - AED
            - AUD
            - BDT
            - BRL
            - CAD
            - CHF
            - CNY
            - COP
            - CZK
            - DKK
            - EUR
            - GBP
            - GHS
            - HKD
            - IDR
            - ILS
            - INR
            - JPY
            - JOD
            - KES
            - KRW
            - MXN
            - NGN
            - NOK
            - NZD
            - PEN
            - PHP
            - SAR
            - SGD
            - USD
            - PKR
            - THB
            - TRY
            - TWD
            - TZS
            - VND
            - SEK
            - ISK
            - ZAR
        comments:
          type: array
          items:
            $ref: '#/components/schemas/DatumNote'
    DatumCommentWrite:
      required:
        - content
      type: object
      properties:
        content:
          title: Content
          type: string
    DatumNote:
      type: object
      properties:
        content:
          title: Content
          type: string
        updated_by:
          title: Updated by
          minLength: 1
          type: string
          nullable: true
          readOnly: true
        updated_at:
          title: Updated at
          type: string
          format: date-time
          readOnly: true
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Your valid bearer token. All Auth tokens persist for all requests. Make
        sure to replace Client Credential `Basic` tokens with `Bearer` tokens
        after retrieving your bearer token. Go to the API Reference/Setup, User
        Guides/Initial Setup, or API Reference/Get API Access Token page to get
        your token.

````