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

# Create or update a custom object record by external_id

> Finds the object's record with the body's `external_id` on the body's account or contact and updates it, or creates the record when there is none (a create needs a Statisfy object). `result` says which. What each field takes is in GET /v1/fields?object=<object>: its type, its options, and whether the API may write it (`writable`). A field your CRM fills is written only while Salesforce writeback is on for the object, and can't be cleared here; an object a warehouse or another system fills is read only. Every problem with the body comes back at once, in one 422.



## OpenAPI

````yaml /api/statisfy-api.openapi.json put /v1/objects/{object}/records
openapi: 3.1.0
info:
  description: >-
    The agent-first Statisfy API. Authenticate with an API key (`Authorization:
    Bearer stfy_live_…`), then call `GET /v1/meta/capabilities` to discover
    every operation and its schemas.
  title: Statisfy API
  version: 1.0.0
servers:
  - url: https://api.statisfy.com
    description: Production
security: []
paths:
  /v1/objects/{object}/records:
    put:
      tags:
        - custom_objects
      summary: Create or update a custom object record by external_id
      description: >-
        Finds the object's record with the body's `external_id` on the body's
        account or contact and updates it, or creates the record when there is
        none (a create needs a Statisfy object). `result` says which. What each
        field takes is in GET /v1/fields?object=<object>: its type, its options,
        and whether the API may write it (`writable`). A field your CRM fills is
        written only while Salesforce writeback is on for the object, and can't
        be cleared here; an object a warehouse or another system fills is read
        only. Every problem with the body comes back at once, in one 422.
      operationId: custom_objects_upsert
      parameters:
        - description: The custom object's key, as GET /v1/objects lists it
          in: path
          name: object
          required: true
          schema:
            maxLength: 200
            minLength: 1
            type: string
        - description: >-
            The key that finds the record to update, with the account or contact
            it belongs to
          in: query
          name: match
          required: true
          schema:
            const: external_id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              properties:
                account_id:
                  default: null
                  description: >-
                    The account it belongs to, for an object whose records
                    belong to accounts
                  title: Account Id
                  type: string
                contact_id:
                  default: null
                  description: >-
                    The contact it belongs to, for an object whose records
                    belong to contacts
                  title: Contact Id
                  type: string
                external_id:
                  default: null
                  description: >-
                    Its id in your system, unique on its account or contact:
                    what an upsert matches on
                  title: External Id
                  type: string
                fields:
                  anyOf:
                    - additionalProperties: true
                      type: object
                    - type: 'null'
                  default: null
                  description: >-
                    Field keys to values, keyed as GET
                    /v1/fields?object=<object> lists them
                  title: Fields
              type: object
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpsertedCustomObjectRecord'
          description: Successful Response
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpsertedCustomObjectRecord'
          description: Created
      security:
        - HTTPBearer: []
components:
  schemas:
    UpsertedCustomObjectRecord:
      properties:
        account_id:
          anyOf:
            - type: string
            - type: 'null'
          description: The account it belongs to; null when it belongs to a contact
          title: Account Id
        contact_id:
          anyOf:
            - type: string
            - type: 'null'
          description: The contact it belongs to; null when it belongs to an account
          title: Contact Id
        created_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Created At
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Its id in the system that fills the object, such as a Salesforce
            record id
          title: External Id
        fields:
          additionalProperties: true
          description: Its values, keyed as GET /v1/fields?object=<object> lists them
          title: Fields
          type: object
        id:
          title: Id
          type: string
        object:
          description: The custom object's key
          title: Object
          type: string
        result:
          enum:
            - created
            - updated
          title: Result
          type: string
        updated_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Updated At
      required:
        - id
        - object
        - result
      title: UpsertedCustomObjectRecord
      type: object
  securitySchemes:
    HTTPBearer:
      scheme: bearer
      type: http
      description: >-
        An API key, sent as `Authorization: Bearer stfy_live_…`. See
        [Authentication](/rest-api/authentication) for how to get one and which
        scopes it needs.

````

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