---
title: "PATCH: Partially updates document in the collection"
method: PATCH
path: "/{collection}/{identifier}"
tags: ["generic"]
---

# PATCH: Partially updates document in the collection

`PATCH /{collection}/{identifier}`

Normally the document with the matching `identifier` will be retrieved from the collection and it will be patched by all specified fields from the JSON request body. Finally 200 HTTP status code will be returned.

If the document has been found in the collection but it had already been deleted, 410 HTTP status code is to be returned.

When no document with `identifier` has been found in the collection, then the operation ends with 404 HTTP status code.

You can also specify `If-Unmodified-Since` request header including your timestamp of document's last modification. If the document has been modified by somebody else on the server afterwards (and you do not know about it), the 412 HTTP status code is returned cancelling the update operation. You can use this feature to prevent race condition problems.

`PATCH` operation can save some bandwidth for incremental document updates in comparison with `GET` - `UPDATE` operation sequence.

While patching the document, the field `modifiedBy` is automatically set to the authorized subject's name.

This operation provides autopruning of the collection (if autopruning is enabled).

This operation requires `update` permission for the API and the collection (e.g. `api:treatments:update`)

## Headers

- `If-Unmodified-Since` string

## Request body

- union — Single document
  - object — Shared base for all documents
    - `identifier` string — Main addressing, required field that identifies document in the collection. The client should not create the identifier, the server automatically assigns it when the document is inserted. The server calculates the identifier in such a way that duplicate records are automatically merged (deduplicating is made by `date`, `device` and `eventType` fields). The best practise for all applications is not to loose identifiers from received documents, but save them carefully for other consumer applications/systems. API v3 has a fallback mechanism in place, for documents without `identifier` field the `identifier` is set to internal `_id`, when reading or addressing these documents. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `date` integer, required — Required timestamp when the record or event occured, you can choose from three input formats - Unix epoch in milliseconds (1525383610088) - Unix epoch in seconds (1525383610) - ISO 8601 with optional timezone ('2018-05-03T21:40:10.088Z' or '2018-05-03T23:40:10.088+02:00') The date is always stored in a normalized form - UTC with zero offset. If UTC offset was present, it is going to be set in the `utcOffset` field. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `utcOffset` integer — Local UTC offset (timezone) of the event in minutes. This field can be set either directly by the client (in the incoming document) or it is automatically parsed from the `date` field. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `app` string, required — Application or system in which the record was entered by human or device for the first time. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `device` string — The device from which the data originated (including serial number of the device, if it is relevant and safe). Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `_id` string — Internally assigned database id. This field is for internal server purposes only, clients communicate with API by using identifier field.
    - `srvCreated` integer — The server's timestamp of document insertion into the database (Unix epoch in ms). This field appears only for documents which were inserted by API v3. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `subject` string — Name of the security subject (within Nightscout scope) which has created the document. This field is automatically set by the server from the passed JWT. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `srvModified` integer — The server's timestamp of the last document modification in the database (Unix epoch in ms). This field appears only for documents which were somehow modified by API v3 (inserted, updated or deleted). Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `modifiedBy` string — Name of the security subject (within Nightscout scope) which has patched or deleted the document for the last time. This field is automatically set by the server. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `isValid` boolean — A flag set by the server only for deleted documents. This field appears only within history operation and for documents which were deleted by API v3 (and they always have a false value) Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `isReadOnly` boolean — A flag set by client that locks the document from any changes. Every document marked with `isReadOnly=true` is forever immutable and cannot even be deleted. Any attempt to modify the read-only document will end with status 422 UNPROCESSABLE ENTITY.
    - `some_property` string — ...
  - object — Shared base for all documents
    - `identifier` string — Main addressing, required field that identifies document in the collection. The client should not create the identifier, the server automatically assigns it when the document is inserted. The server calculates the identifier in such a way that duplicate records are automatically merged (deduplicating is made by `date`, `device` and `eventType` fields). The best practise for all applications is not to loose identifiers from received documents, but save them carefully for other consumer applications/systems. API v3 has a fallback mechanism in place, for documents without `identifier` field the `identifier` is set to internal `_id`, when reading or addressing these documents. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `date` integer, required — Required timestamp when the record or event occured, you can choose from three input formats - Unix epoch in milliseconds (1525383610088) - Unix epoch in seconds (1525383610) - ISO 8601 with optional timezone ('2018-05-03T21:40:10.088Z' or '2018-05-03T23:40:10.088+02:00') The date is always stored in a normalized form - UTC with zero offset. If UTC offset was present, it is going to be set in the `utcOffset` field. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `utcOffset` integer — Local UTC offset (timezone) of the event in minutes. This field can be set either directly by the client (in the incoming document) or it is automatically parsed from the `date` field. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `app` string, required — Application or system in which the record was entered by human or device for the first time. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `device` string — The device from which the data originated (including serial number of the device, if it is relevant and safe). Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `_id` string — Internally assigned database id. This field is for internal server purposes only, clients communicate with API by using identifier field.
    - `srvCreated` integer — The server's timestamp of document insertion into the database (Unix epoch in ms). This field appears only for documents which were inserted by API v3. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `subject` string — Name of the security subject (within Nightscout scope) which has created the document. This field is automatically set by the server from the passed JWT. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `srvModified` integer — The server's timestamp of the last document modification in the database (Unix epoch in ms). This field appears only for documents which were somehow modified by API v3 (inserted, updated or deleted). Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `modifiedBy` string — Name of the security subject (within Nightscout scope) which has patched or deleted the document for the last time. This field is automatically set by the server. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `isValid` boolean — A flag set by the server only for deleted documents. This field appears only within history operation and for documents which were deleted by API v3 (and they always have a false value) Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `isReadOnly` boolean — A flag set by client that locks the document from any changes. Every document marked with `isReadOnly=true` is forever immutable and cannot even be deleted. Any attempt to modify the read-only document will end with status 422 UNPROCESSABLE ENTITY.
    - `type` string — sgv, mbg, cal, etc
    - `sgv` number — The glucose reading. (only available for sgv types)
    - `direction` string — Direction of glucose trend reported by CGM. (only available for sgv types)
    - `noise` number — Noise level at time of reading. (only available for sgv types)
    - `filtered` number — The raw filtered value directly from CGM transmitter. (only available for sgv types)
    - `unfiltered` number — The raw unfiltered value directly from CGM transmitter. (only available for sgv types)
    - `rssi` number — The signal strength from CGM transmitter. (only available for sgv types)
    - `units` string — The units for the glucose value, mg/dl or mmol/l. It is strongly recommended to fill in this field.
  - object — Shared base for all documents
    - `identifier` string — Main addressing, required field that identifies document in the collection. The client should not create the identifier, the server automatically assigns it when the document is inserted. The server calculates the identifier in such a way that duplicate records are automatically merged (deduplicating is made by `date`, `device` and `eventType` fields). The best practise for all applications is not to loose identifiers from received documents, but save them carefully for other consumer applications/systems. API v3 has a fallback mechanism in place, for documents without `identifier` field the `identifier` is set to internal `_id`, when reading or addressing these documents. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `date` integer, required — Required timestamp when the record or event occured, you can choose from three input formats - Unix epoch in milliseconds (1525383610088) - Unix epoch in seconds (1525383610) - ISO 8601 with optional timezone ('2018-05-03T21:40:10.088Z' or '2018-05-03T23:40:10.088+02:00') The date is always stored in a normalized form - UTC with zero offset. If UTC offset was present, it is going to be set in the `utcOffset` field. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `utcOffset` integer — Local UTC offset (timezone) of the event in minutes. This field can be set either directly by the client (in the incoming document) or it is automatically parsed from the `date` field. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `app` string, required — Application or system in which the record was entered by human or device for the first time. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `device` string — The device from which the data originated (including serial number of the device, if it is relevant and safe). Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `_id` string — Internally assigned database id. This field is for internal server purposes only, clients communicate with API by using identifier field.
    - `srvCreated` integer — The server's timestamp of document insertion into the database (Unix epoch in ms). This field appears only for documents which were inserted by API v3. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `subject` string — Name of the security subject (within Nightscout scope) which has created the document. This field is automatically set by the server from the passed JWT. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `srvModified` integer — The server's timestamp of the last document modification in the database (Unix epoch in ms). This field appears only for documents which were somehow modified by API v3 (inserted, updated or deleted). Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `modifiedBy` string — Name of the security subject (within Nightscout scope) which has patched or deleted the document for the last time. This field is automatically set by the server. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `isValid` boolean — A flag set by the server only for deleted documents. This field appears only within history operation and for documents which were deleted by API v3 (and they always have a false value) Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `isReadOnly` boolean — A flag set by client that locks the document from any changes. Every document marked with `isReadOnly=true` is forever immutable and cannot even be deleted. Any attempt to modify the read-only document will end with status 422 UNPROCESSABLE ENTITY.
    - `food` string — food, quickpick
    - `category` string — Name for a group of related records
    - `subcategory` string — Name for a second level of groupping
    - `name` string — Name of the food described
    - `portion` number — Number of units (e.g. grams) of the whole portion described
    - `unit` string — Unit for the portion
    - `carbs` number — Amount of carbs in the portion in grams
    - `fat` number — Amount of fat in the portion in grams
    - `protein` number — Amount of proteins in the portion in grams
    - `energy` number — Amount of energy in the portion in kJ
    - `gi` number — Glycemic index (1=low, 2=medium, 3=high)
    - `hideafteruse` boolean — Flag used for quickpick
    - `hidden` boolean — Flag used for quickpick
    - `position` number — Ordering field for quickpick
    - `portions` number — component multiplier if defined inside quickpick compound
    - `foods` Food[] — Neighbour documents (from food collection) that together make a quickpick compound
      - `identifier` string — Main addressing, required field that identifies document in the collection. The client should not create the identifier, the server automatically assigns it when the document is inserted. The server calculates the identifier in such a way that duplicate records are automatically merged (deduplicating is made by `date`, `device` and `eventType` fields). The best practise for all applications is not to loose identifiers from received documents, but save them carefully for other consumer applications/systems. API v3 has a fallback mechanism in place, for documents without `identifier` field the `identifier` is set to internal `_id`, when reading or addressing these documents. Note&#58; this field is immutable by the client (it cannot be updated or patched)
      - `date` integer, required — Required timestamp when the record or event occured, you can choose from three input formats - Unix epoch in milliseconds (1525383610088) - Unix epoch in seconds (1525383610) - ISO 8601 with optional timezone ('2018-05-03T21:40:10.088Z' or '2018-05-03T23:40:10.088+02:00') The date is always stored in a normalized form - UTC with zero offset. If UTC offset was present, it is going to be set in the `utcOffset` field. Note&#58; this field is immutable by the client (it cannot be updated or patched)
      - `utcOffset` integer — Local UTC offset (timezone) of the event in minutes. This field can be set either directly by the client (in the incoming document) or it is automatically parsed from the `date` field. Note&#58; this field is immutable by the client (it cannot be updated or patched)
      - `app` string, required — Application or system in which the record was entered by human or device for the first time. Note&#58; this field is immutable by the client (it cannot be updated or patched)
      - `device` string — The device from which the data originated (including serial number of the device, if it is relevant and safe). Note&#58; this field is immutable by the client (it cannot be updated or patched)
      - `_id` string — Internally assigned database id. This field is for internal server purposes only, clients communicate with API by using identifier field.
      - `srvCreated` integer — The server's timestamp of document insertion into the database (Unix epoch in ms). This field appears only for documents which were inserted by API v3. Note&#58; this field is immutable by the client (it cannot be updated or patched)
      - `subject` string — Name of the security subject (within Nightscout scope) which has created the document. This field is automatically set by the server from the passed JWT. Note&#58; this field is immutable by the client (it cannot be updated or patched)
      - `srvModified` integer — The server's timestamp of the last document modification in the database (Unix epoch in ms). This field appears only for documents which were somehow modified by API v3 (inserted, updated or deleted). Note&#58; this field is immutable by the client (it cannot be updated or patched)
      - `modifiedBy` string — Name of the security subject (within Nightscout scope) which has patched or deleted the document for the last time. This field is automatically set by the server. Note&#58; this field is immutable by the client (it cannot be updated or patched)
      - `isValid` boolean — A flag set by the server only for deleted documents. This field appears only within history operation and for documents which were deleted by API v3 (and they always have a false value) Note&#58; this field is immutable by the client (it cannot be updated or patched)
      - `isReadOnly` boolean — A flag set by client that locks the document from any changes. Every document marked with `isReadOnly=true` is forever immutable and cannot even be deleted. Any attempt to modify the read-only document will end with status 422 UNPROCESSABLE ENTITY.
      - `food` string — food, quickpick
      - `category` string — Name for a group of related records
      - `subcategory` string — Name for a second level of groupping
      - `name` string — Name of the food described
      - `portion` number — Number of units (e.g. grams) of the whole portion described
      - `unit` string — Unit for the portion
      - `carbs` number — Amount of carbs in the portion in grams
      - `fat` number — Amount of fat in the portion in grams
      - `protein` number — Amount of proteins in the portion in grams
      - `energy` number — Amount of energy in the portion in kJ
      - `gi` number — Glycemic index (1=low, 2=medium, 3=high)
      - `hideafteruse` boolean — Flag used for quickpick
      - `hidden` boolean — Flag used for quickpick
      - `position` number — Ordering field for quickpick
      - `portions` number — component multiplier if defined inside quickpick compound
      - `foods` Food[] — Neighbour documents (from food collection) that together make a quickpick compound
  - object — Shared base for all documents
    - `identifier` string — Main addressing, required field that identifies document in the collection. The client should not create the identifier, the server automatically assigns it when the document is inserted. The server calculates the identifier in such a way that duplicate records are automatically merged (deduplicating is made by `date`, `device` and `eventType` fields). The best practise for all applications is not to loose identifiers from received documents, but save them carefully for other consumer applications/systems. API v3 has a fallback mechanism in place, for documents without `identifier` field the `identifier` is set to internal `_id`, when reading or addressing these documents. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `date` integer, required — Required timestamp when the record or event occured, you can choose from three input formats - Unix epoch in milliseconds (1525383610088) - Unix epoch in seconds (1525383610) - ISO 8601 with optional timezone ('2018-05-03T21:40:10.088Z' or '2018-05-03T23:40:10.088+02:00') The date is always stored in a normalized form - UTC with zero offset. If UTC offset was present, it is going to be set in the `utcOffset` field. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `utcOffset` integer — Local UTC offset (timezone) of the event in minutes. This field can be set either directly by the client (in the incoming document) or it is automatically parsed from the `date` field. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `app` string, required — Application or system in which the record was entered by human or device for the first time. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `device` string — The device from which the data originated (including serial number of the device, if it is relevant and safe). Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `_id` string — Internally assigned database id. This field is for internal server purposes only, clients communicate with API by using identifier field.
    - `srvCreated` integer — The server's timestamp of document insertion into the database (Unix epoch in ms). This field appears only for documents which were inserted by API v3. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `subject` string — Name of the security subject (within Nightscout scope) which has created the document. This field is automatically set by the server from the passed JWT. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `srvModified` integer — The server's timestamp of the last document modification in the database (Unix epoch in ms). This field appears only for documents which were somehow modified by API v3 (inserted, updated or deleted). Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `modifiedBy` string — Name of the security subject (within Nightscout scope) which has patched or deleted the document for the last time. This field is automatically set by the server. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `isValid` boolean — A flag set by the server only for deleted documents. This field appears only within history operation and for documents which were deleted by API v3 (and they always have a false value) Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `isReadOnly` boolean — A flag set by client that locks the document from any changes. Every document marked with `isReadOnly=true` is forever immutable and cannot even be deleted. Any attempt to modify the read-only document will end with status 422 UNPROCESSABLE ENTITY.
    - `some_property` string — ...
  - object — Shared base for all documents
    - `identifier` string — Main addressing, required field that identifies document in the collection. The client should not create the identifier, the server automatically assigns it when the document is inserted. The server calculates the identifier in such a way that duplicate records are automatically merged (deduplicating is made by `date`, `device` and `eventType` fields). The best practise for all applications is not to loose identifiers from received documents, but save them carefully for other consumer applications/systems. API v3 has a fallback mechanism in place, for documents without `identifier` field the `identifier` is set to internal `_id`, when reading or addressing these documents. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `date` integer, required — Required timestamp when the record or event occured, you can choose from three input formats - Unix epoch in milliseconds (1525383610088) - Unix epoch in seconds (1525383610) - ISO 8601 with optional timezone ('2018-05-03T21:40:10.088Z' or '2018-05-03T23:40:10.088+02:00') The date is always stored in a normalized form - UTC with zero offset. If UTC offset was present, it is going to be set in the `utcOffset` field. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `utcOffset` integer — Local UTC offset (timezone) of the event in minutes. This field can be set either directly by the client (in the incoming document) or it is automatically parsed from the `date` field. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `app` string, required — Application or system in which the record was entered by human or device for the first time. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `device` string — The device from which the data originated (including serial number of the device, if it is relevant and safe). Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `_id` string — Internally assigned database id. This field is for internal server purposes only, clients communicate with API by using identifier field.
    - `srvCreated` integer — The server's timestamp of document insertion into the database (Unix epoch in ms). This field appears only for documents which were inserted by API v3. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `subject` string — Name of the security subject (within Nightscout scope) which has created the document. This field is automatically set by the server from the passed JWT. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `srvModified` integer — The server's timestamp of the last document modification in the database (Unix epoch in ms). This field appears only for documents which were somehow modified by API v3 (inserted, updated or deleted). Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `modifiedBy` string — Name of the security subject (within Nightscout scope) which has patched or deleted the document for the last time. This field is automatically set by the server. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `isValid` boolean — A flag set by the server only for deleted documents. This field appears only within history operation and for documents which were deleted by API v3 (and they always have a false value) Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `isReadOnly` boolean — A flag set by client that locks the document from any changes. Every document marked with `isReadOnly=true` is forever immutable and cannot even be deleted. Any attempt to modify the read-only document will end with status 422 UNPROCESSABLE ENTITY.
    - `some_property` string — ...
  - object — Shared base for all documents
    - `identifier` string — Main addressing, required field that identifies document in the collection. The client should not create the identifier, the server automatically assigns it when the document is inserted. The server calculates the identifier in such a way that duplicate records are automatically merged (deduplicating is made by `date`, `device` and `eventType` fields). The best practise for all applications is not to loose identifiers from received documents, but save them carefully for other consumer applications/systems. API v3 has a fallback mechanism in place, for documents without `identifier` field the `identifier` is set to internal `_id`, when reading or addressing these documents. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `date` integer, required — Required timestamp when the record or event occured, you can choose from three input formats - Unix epoch in milliseconds (1525383610088) - Unix epoch in seconds (1525383610) - ISO 8601 with optional timezone ('2018-05-03T21:40:10.088Z' or '2018-05-03T23:40:10.088+02:00') The date is always stored in a normalized form - UTC with zero offset. If UTC offset was present, it is going to be set in the `utcOffset` field. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `utcOffset` integer — Local UTC offset (timezone) of the event in minutes. This field can be set either directly by the client (in the incoming document) or it is automatically parsed from the `date` field. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `app` string, required — Application or system in which the record was entered by human or device for the first time. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `device` string — The device from which the data originated (including serial number of the device, if it is relevant and safe). Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `_id` string — Internally assigned database id. This field is for internal server purposes only, clients communicate with API by using identifier field.
    - `srvCreated` integer — The server's timestamp of document insertion into the database (Unix epoch in ms). This field appears only for documents which were inserted by API v3. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `subject` string — Name of the security subject (within Nightscout scope) which has created the document. This field is automatically set by the server from the passed JWT. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `srvModified` integer — The server's timestamp of the last document modification in the database (Unix epoch in ms). This field appears only for documents which were somehow modified by API v3 (inserted, updated or deleted). Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `modifiedBy` string — Name of the security subject (within Nightscout scope) which has patched or deleted the document for the last time. This field is automatically set by the server. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `isValid` boolean — A flag set by the server only for deleted documents. This field appears only within history operation and for documents which were deleted by API v3 (and they always have a false value) Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `isReadOnly` boolean — A flag set by client that locks the document from any changes. Every document marked with `isReadOnly=true` is forever immutable and cannot even be deleted. Any attempt to modify the read-only document will end with status 422 UNPROCESSABLE ENTITY.
    - `eventType` string — The type of treatment event. Note&#58; this field is immutable by the client (it cannot be updated or patched)
    - `glucose` string — Current glucose.
    - `glucoseType` string — Method used to obtain glucose, Finger or Sensor.
    - `units` string — The units for the glucose value, mg/dl or mmol/l. It is strongly recommended to fill in this field when `glucose` is entered.
    - `carbs` number — Amount of carbs given.
    - `protein` number — Amount of protein given.
    - `fat` number — Amount of fat given.
    - `insulin` number — Amount of insulin, if any.
    - `duration` number — Duration in minutes.
    - `preBolus` number — How many minutes the bolus was given before the meal started.
    - `splitNow` number — Immediate part of combo bolus (in percent).
    - `splitExt` number — Extended part of combo bolus (in percent).
    - `percent` number — Eventual basal change in percent.
    - `absolute` number — Eventual basal change in absolute value (insulin units per hour).
    - `targetTop` number — Top limit of temporary target.
    - `targetBottom` number — Bottom limit of temporary target.
    - `profile` string — Name of the profile to which the pump has been switched.
    - `reason` string — For example the reason why the profile has been switched or why the temporary target has been set.
    - `notes` string — Description/notes of treatment.
    - `enteredBy` string — Who entered the treatment.

## Response `200`

The request was successfully processed

- object
  - `status` integer

## Other responses

- `400` — The request is malformed. There may be some required parameters missing or there are unrecognized parameters present.
- `401` — The request was not successfully authenticated using JWT, so that the request cannot continue due to the security policy.
- `403` — Insecure HTTP scheme used or the request has been successfully authenticated, but the security subject is not authorized for the operation.
- `404` — The collection or document specified was not found.
- `410` — The requested document has already been deleted.
- `412` — The document has already been modified on the server since specified timestamp (in If-Unmodified-Since header).
- `422` — The client request is well formed but a server validation error occured. Eg. when trying to modify or delete a read-only document (having `isReadOnly=true`).

## Changes

- **2026-07-17** `5b0d424433e1` — 1 info
  - the endpoint scheme security `accessToken` was removed from the API
- **2021-01-07** `8252719e8e34` — 1 breaking, 11 info
  - removed the success response with the status `204`
  - the endpoint scheme security `accessToken` was added to the API
  - the endpoint scheme security `jwtoken` was added to the API
  - the endpoint scheme security `apiKeyAuth` was removed from the API
  - …8 more
- **2019-11-02** `6b2eb690f4ab` — 7 info
  - added the new optional request property `oneOf[#/components/schemas/DeviceStatus]/allOf[#/components/schemas/DocumentBase]/isReadOnly`
  - added the new optional request property `oneOf[#/components/schemas/Entry]/allOf[#/components/schemas/DocumentBase]/isReadOnly`
  - added the new optional request property `oneOf[#/components/schemas/Food]/allOf[#/components/schemas/DocumentBase]/isReadOnly`
  - added the new optional request property `oneOf[#/components/schemas/Profile]/allOf[#/components/schemas/DocumentBase]/isReadOnly`
  - …3 more
- **2019-10-09** `e3a793475629` — 7 breaking, 6 warning, 7 info
  - removed the media type `application/json` for the response with the status `400`
  - removed the media type `application/json` for the response with the status `401`
  - removed the media type `application/json` for the response with the status `403`
  - removed the media type `application/json` for the response with the status `404`
  - …16 more

[Change history](https://skmtc.dev/nightscout/apis/nightscout-api/changes/:collection/:identifier/patch.md)

---

[API](https://skmtc.dev/nightscout/apis/nightscout-api.md) · [All operations](https://skmtc.dev/nightscout/apis/nightscout-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/nightscout/nightscout-api/revisions/5b0d424433e1/schema)
