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

# Update record

> Update an existing record by ID.

## Overview

Update a record by ID. Put the attributes you want to change inside `data`.
Supplied values replace existing values, while omitted attributes retain their
values. To fill only missing values, use
[Upsert record](https://docs.unifygtm.com/developers/api/data/records/upsert.md) with `update_if_empty`.

## Examples

Set `UNIFY_API_KEY` to your API key.

> [accordion] Update a company description
>
> Replace the example IDs with records from
> your workspace.
>
> ```bash theme={null}
> curl --request PATCH \
>   --url "https://api.unifygtm.com/data/v1/objects/company/records/73fcb798-9ccd-4138-8f6a-9a801123783c" \
>   --header "X-Api-Key: $UNIFY_API_KEY" \
>   --header "Content-Type: application/json" \
>   --data '{
>   "data": {
>     "description": "Laboratory operations software for multi-site research teams."
>   }
> }'
> ```

> [accordion] Update a person's job
>
> Update the person's title and company together. This example references the
> company by record ID:
>
> ```bash theme={null}
> curl --request PATCH \
>   --url "https://api.unifygtm.com/data/v1/objects/person/records/bf3f4d5e-c995-496f-8774-5a1c58d05197" \
>   --header "X-Api-Key: $UNIFY_API_KEY" \
>   --header "Content-Type: application/json" \
>   --data '{
>   "data": {
>     "title": "VP of operations",
>     "company": {
>       "id": "73fcb798-9ccd-4138-8f6a-9a801123783c"
>     }
>   }
> }'
> ```
>
> A successful response contains the updated record in `data`. If the target
> record does not exist, the API returns `404`.

> [accordion] Update a custom record
>
> For a custom object, use its API name in the URL and its attribute API names in
> `data`. For example, a `product_user` object with a `plan` attribute could use:
>
> ```json theme={null}
> {
>   "data": { "plan": "enterprise" }
> }
> ```
>
> The attribute and any referenced select option must already exist.


## OpenAPI

````yaml PATCH /data/v1/objects/{object_name}/records/{record_id}
openapi: 3.1.0
info:
  title: Unify Data API
  summary: Interact with objects, attributes, and records within the Unify platform.
  version: '1'
  termsOfService: https://www.unifygtm.com/legal/terms-and-conditions
  contact:
    name: Unify Support
    url: https://www.unifygtm.com/support
    email: support@unifygtm.com
servers:
  - url: https://api.unifygtm.com
    variables: {}
security:
  - ApiKeyAuth: []
tags:
  - name: Data
  - name: Object Record Query Jobs
  - name: Event Query Jobs
  - name: Lists
  - name: List Entries
  - name: Objects
  - name: Object Attributes
  - name: Object Attribute Options
  - name: Object Records
paths:
  /data/v1/objects/{object_name}/records/{record_id}:
    patch:
      tags:
        - Data
        - Object Records
      description: Update a record by its ID.
      operationId: update_object_record
      parameters:
        - name: object_name
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UObjects.UObjectName'
        - name: record_id
          in: path
          required: true
          schema:
            type: string
        - name: validation_mode
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/ValidationMode'
          explode: false
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateRecordRequest'
      responses:
        '200':
          description: Response for a successful update operation.
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - data
                properties:
                  status:
                    type: string
                    enum:
                      - success
                  data:
                    type: object
                    required:
                      - object
                      - id
                      - created_at
                      - updated_at
                      - attributes
                    properties:
                      object:
                        type: string
                        description: >-
                          The API name of the object this record is an instance
                          of.
                        readOnly: true
                      id:
                        $ref: '#/components/schemas/UValues.UUuid'
                        description: Unique UUID identifier for the record.
                        readOnly: true
                      created_at:
                        type: string
                        format: date-time
                        description: Date and time the record was created.
                        readOnly: true
                      updated_at:
                        type: string
                        format: date-time
                        description: Date and time the record was last updated.
                        readOnly: true
                      attributes:
                        type: object
                        unevaluatedProperties:
                          anyOf:
                            - $ref: '#/components/schemas/UValues.UValue'
                            - type: 'null'
                        description: >-
                          Attribute values for the record. Each key is the API
                          name of the attribute

                          and each value is the corresponding attribute value
                          for the record.
                description: Response for a successful update operation.
        '400':
          description: Response for any operation that results in a bad request error.
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                properties:
                  status:
                    type: string
                    enum:
                      - bad_request
                      - record_missing_required_field
                      - referenced_record_not_found
                  errors:
                    type: array
                    items:
                      $ref: '#/components/schemas/UResponses.BadRequestError'
                  message:
                    type: string
                description: >-
                  Response for any operation that results in a bad request
                  error.
        '401':
          description: Response for any operation that results in an unauthorized error.
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - message
                properties:
                  status:
                    type: string
                    enum:
                      - unauthorized
                  message:
                    type: string
                description: >-
                  Response for any operation that results in an unauthorized
                  error.
        '404':
          description: Response for any operation that results in a not found error.
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - message
                properties:
                  status:
                    type: string
                    enum:
                      - object_not_found
                      - record_not_found
                  message:
                    type: string
                description: Response for any operation that results in a not found error.
        '409':
          description: Response for any operation that results in a conflict error.
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - message
                properties:
                  status:
                    type: string
                    enum:
                      - record_conflict
                  message:
                    type: string
                description: Response for any operation that results in a conflict error.
        '500':
          description: Response for any operation that results in an internal server error.
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - message
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                description: >-
                  Response for any operation that results in an internal server
                  error.
        '503':
          description: Response for any operation that results in service unavailability.
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - message
                properties:
                  status:
                    type: string
                    enum:
                      - service_unavailable
                  message:
                    type: string
                description: >-
                  Response for any operation that results in service
                  unavailability.
components:
  schemas:
    UObjects.UObjectName:
      type: string
      description: |-
        The API name of an object, e.g. `company`, `person`, `opportunity`, or a
        custom object's API name.
    ValidationMode:
      type: string
      enum:
        - strict
        - ignore_invalid
      description: >-
        Validation mode for request data.


        - `strict`: Reject requests if any attribute is invalid or unrecognized.

        - `ignore_invalid`: Ignore unknown attributes and omit invalid values
        for

        optional attributes. Reject requests with an invalid body structure or

        invalid required attributes.
    UpdateRecordRequest:
      type: object
      required:
        - data
      properties:
        data:
          type: object
          unevaluatedProperties:
            $ref: '#/components/schemas/UValues.UValue'
          description: >-
            The attribute values to update. Omitted attributes retain their
            existing

            values.
      description: Request body for updating a record.
    UValues.UUuid:
      type: string
      description: String UUIDv4 value.
      title: UUuid
    UResponses.BadRequestError:
      type: object
      required:
        - code
      properties:
        code:
          type: string
        path:
          type: array
          items:
            anyOf:
              - type: string
              - type: integer
        object_api_name:
          type: string
        attribute_api_name:
          type: string
      allOf:
        - type: object
          unevaluatedProperties: {}
      description: Validation error detail returned for bad request responses.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.