> ## Documentation Index > Fetch the complete documentation index at: https://support.tulip.co/llms.txt > Use this file to discover all available pages before exploring further. # Increment or decrement a field in a Tulip Table record > Increment or decrement an integer or float field of a Tulip Table Record. A decrement is simply a negative increment. The tableId must exist. The recordId must be associated with the tableId. The field name must match the column name of the table. The respective column type in the table must be incrementable. The value type must be incrementable (so an integer or float). If the field type is an integer, then the value can be either an integer or a float, but if it is a float, it will be rounded off (e.g. 2.7 rounds up to 3). If the field type is a float, then the value type can also be either an integer or a float. The record's `_updatedAt` field will be updated to the current time. If the value to be incremented has not been set yet, then it will be treated like an increment on a 0 value. Requires the `tables:write` API key scope. When incrementing a Tulip number field (_not_ integer field), you may specify the increment value as either a JSON number or a string. If specifying the number as a string, it must be of format `"[-]xx[.yyy]"`. This corresponds to the JSON number format, except that the exponent component is not allowed (in other words, you cannot use scientific notation). If you specify the value a string, it may contain trailing zeros, which will be preserved in the operation. If you specify the value as a JSON number, the operation will not preserve trailing zeros, including any that may have been in the value before this increment operation. ## OpenAPI ````json PATCH /tables/{tableId}/records/{recordId}/increment { "openapi": "3.0.3", "info": { "title": "Tulip API", "description": "The Tulip API gives you programmatic access to your Tulip data.\n\n### Query Parameters\n\nSome Tulip API endpoints take parameters specified in the [URL query](https://en.wikipedia.org/wiki/Query_string). In the Tulip API, the URL query is expected to be a list of key-value pairs, with pairs separated by `&`, keys and values separated by `=`, and keys and values being [percent-encoded](https://en.wikipedia.org/wiki/Percent-encoding). Keys are parsed as strings, values *must* be present for each key, and values are parsed as JSON. Simple string values may be specified as-is instead of being JSON-encoded. A query parameter may be specified multiple times, but only the final value will be used. Examples (shown without percent encoding for readability):\n\n * `a=1&b=true&c=\"hello\"` would parse a parameter `a` as the number 1, `b` as the boolean `true`, and `c` as the string `hello`\n * `a=foo&b=\"foo\"` would parse a parameter `a` as the string `foo` and `b` as the string `foo`\n * `data={\"points\":[{\"x\":3,\"y\":4},{\"x\":2,\"y\":-9}]}` would parse a parameter `data` as an object with a single field `points` containing an array with two elements: an object with `x` as the number 3 and `y` as the number 4, and an object with `x` as the number 2 and `y` as the number -9\n * `a=foo&a=bar` would parse a parameter `a` as the string `bar`\n", "termsOfService": "https://tulip.co/tos/", "contact": { "name": "Tulip Interfaces", "url": "https://tulip.co/contact-us/", "email": "sales@tulip.co" }, "version": "3.0" }, "servers": [ { "url": "http://localhost:8088/api/v3", "description": "Cypress Tulip API Server" } ], "paths": { "/tables/{tableId}/records/{recordId}/increment": { "parameters": [ { "$ref": "#/components/parameters/tableId" }, { "$ref": "#/components/parameters/recordId" }, { "$ref": "#/components/parameters/decimalHeaderForWrites" } ], "patch": { "summary": "Increment or decrement a field in a Tulip Table record", "description": "Increment or decrement an integer or float field of a Tulip Table Record.\nA decrement is simply a negative increment.\nThe tableId must exist.\nThe recordId must be associated with the tableId.\nThe field name must match the column name of the table.\nThe respective column type in the table must be incrementable.\nThe value type must be incrementable (so an integer or float).\nIf the field type is an integer, then the value can be either an integer or a float,\nbut if it is a float, it will be rounded off (e.g. 2.7 rounds up to 3). If the field\ntype is a float, then the value type can also be either an integer or a float.\nThe record's `_updatedAt` field will be updated to the current time.\nIf the value to be incremented has not been set yet, then it will be treated like\nan increment on a 0 value.\nRequires the `tables:write` API key scope.\n\nWhen incrementing a Tulip number field (_not_ integer field), you may specify the increment value as either a JSON\nnumber or a string. If specifying the number as a string, it must be of format `\"[-]xx[.yyy]\"`. This corresponds\nto the JSON number format, except that the exponent component is not allowed (in other words, you cannot use\nscientific notation). If you specify the value a string, it may contain trailing zeros, which will be preserved\nin the operation. If you specify the value as a JSON number, the operation will not preserve trailing zeros,\nincluding any that may have been in the value before this increment operation.\n", "x-tulip-visibility": "public", "tags": [ "Tulip Tables" ], "security": [ { "apiKey": [ "tables:write" ] } ], "requestBody": { "description": "Field to increment or decrement\n", "content": { "application/json": { "schema": { "type": "object", "properties": { "fieldName": { "description": "The field (column) to increment or decrement.\n", "type": "string" }, "value": { "description": "The amount to increment or decrement by.\n", "type": "number" } } } } } }, "responses": { "200": { "description": "The field was incremented or decremented successfully.\n", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TulipTableRecord" } } } }, "400": { "$ref": "#/components/responses/badRequestError" }, "401": { "$ref": "#/components/responses/authenticationRequiredError" }, "403": { "$ref": "#/components/responses/authenticationFailedError" }, "404": { "$ref": "#/components/responses/notFoundError" }, "422": { "$ref": "#/components/responses/unprocessableEntityError" }, "500": { "$ref": "#/components/responses/internalServerError" } } } } }, "components": { "parameters": { "tableId": { "name": "tableId", "description": "The id of a Tulip Table.\n", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/ObjectId" } }, "recordId": { "name": "recordId", "description": "The id of a Tulip Table record.\n", "in": "path", "required": true, "schema": { "$ref": "#/components/schemas/RecordId" } }, "decimalHeaderForWrites": { "name": "X-Tulip-Number-Format", "in": "header", "required": false, "description": "The format that Tulip should use in the response when formatting Tulip numbers. If omitted or set to\n`float`, Tulip will format numbers as JSON numbers. If set to `decimal`, Tulip will format numbers as strings\nrepresenting the decimal representation of the number, like `\"1.20\"`. Tulip will only output trailing zeros\nwhen using `decimal` formatting.\n\nThis header only affects the response format. The value written is determined solely by the request body (see\nbody description).\n\nNote that this header only affects Tulip numbers. Other types, including Tulip integers, are unaffected.\n", "schema": { "type": "string", "enum": [ "decimal", "float" ], "default": "float" } } }, "schemas": { "TulipTableRecord": { "x-tulip-visibility": "public", "description": "A single record stored in a Tulip Table. The record object will include the names and values of all columns of the Table that are not hidden, in addition to the record's sequence number, created timestamp, and last updated timestamp.\n", "example": { "_sequenceNumber": 15, "_createdAt": "2019-02-08T20:16:31Z", "_updatedAt": "2019-02-08T20:16:31Z", "id": "bike-a", "ahvbb_model_number": "AAA", "auznd_color": "blue", "irrip_completed": true, "umiyk_durability_test_duration": 123000 }, "type": "object", "properties": { "_sequenceNumber": { "description": "A monotonically increasing unique identifier for this record.\n", "type": "integer" }, "_createdAt": { "allOf": [ { "description": "The time this record was created.\n" }, { "$ref": "#/components/schemas/DateTime" } ] }, "_updatedAt": { "allOf": [ { "description": "The time this record was last updated.\n" }, { "$ref": "#/components/schemas/DateTime" } ] } }, "required": [ "_sequenceNumber", "_createdAt", "_updatedAt" ] }, "ObjectId": { "$ref": "#/components/schemas/RandomId" }, "RecordId": { "x-tulip-visibility": "public", "example": "a record id", "type": "string", "pattern": "^[\\S]+( +[\\S]+)*$" }, "DateTime": { "x-tulip-visibility": "public", "description": "A date-time string as defined by [RFC 3339 ยง5.6](https://tools.ietf.org/html/rfc3339#section-5.6).\n", "type": "string", "format": "date-time" }, "ApiError": { "x-tulip-visibility": "public", "type": "object", "properties": { "errorCode": { "type": "string" }, "errorUniqueID": { "$ref": "#/components/schemas/RandomSecret" }, "details": { "type": "string" } }, "required": [ "errorCode", "details" ] }, "RandomId": { "x-tulip-visibility": "public", "example": "g56RCoZCtzv7borvp", "type": "string", "pattern": "^[a-zA-Z0-9_]+$" }, "RandomSecret": { "x-tulip-visibility": "public", "example": "aq21mSKC1rbO87TjC/4Hz2EJHd/v+jxf7MtC315vo0Y", "type": "string", "pattern": "^[a-zA-Z0-9+/]+$" } }, "responses": { "badRequestError": { "description": "The request was malformed. This could mean that headers, query parameters, or the request body was unable to be parsed or had unexpected values.\n", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } } }, "authenticationRequiredError": { "description": "The request was made unauthorized. HTTP Basic Authorization using a Tulip API Key is required for use of the API.\n", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/ApiError" }, { "type": "object", "properties": { "errorCode": { "enum": [ "AuthenticationRequired" ] } } } ] } } } }, "authenticationFailedError": { "description": "The provided authentication info was rejected. The response will provide additional details.\n", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/ApiError" }, { "type": "object", "properties": { "errorCode": { "enum": [ "AuthenticationFailed" ] } } } ] } } } }, "notFoundError": { "description": "The requested database entry was not found.\n", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/ApiError" }, { "type": "object", "properties": { "errorCode": { "enum": [ "NoSuchDatabaseEntry" ] } } } ] } } } }, "unprocessableEntityError": { "description": "The request was syntactically sound, but could not be processed due to a logical problem.\n", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/ApiError" }, { "type": "object", "properties": { "errorCode": { "enum": [ "UnprocessableEntity" ] } } } ] } } } }, "internalServerError": { "description": "The server encountered an unexpected error.\n", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } } } }, "securitySchemes": { "apiKey": { "type": "http", "scheme": "basic", "description": "Access to the Tulip API requires the use of [HTTP Basic Authentication](https://datatracker.ietf.org/doc/html/rfc7617) using the credentials of an active [Tulip API Token](https://support.tulip.co/docs/set-up-a-tulip-api). All requests require the `Authorization` HTTP header with the `Basic` scheme to provide API credentials unless otherwise noted.\n\nAPI tokens can be configured with a set of _scopes_ which determine what parts of the API that specific token has access to. Security best practices dictate that API credentials be given the minimum set of capabilities required to fulfill their intended purpose. For example, an API token created for use in an integration that is only designed to use the Tables API should probably only be given the `tables:read` and `tables:write` scopes. In this way you can minimize risk in the event that API credentials are compromised. API endpoints will document what API token scopes are required to access that endpoint in their descriptions. If a request is made to an endpoint with an API token which does not have the required scopes, the response will be an authorization error.\n" } } } } ````