> ## 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.

# Update the contact with an address, or create it

> `match=email` finds the contact by its address, whatever its case. A contact has it: the body less `email` is an update, with an update's rules (`accounts` replaces the list; a `name` sent beside parts is kept as sent; a portal user's name keys are a 422), and the answer is 200 with `result: "updated"` (a body of the address alone writes nothing). Nobody has it: the body is a create, with a create's rules (`accounts` required; the name built from parts sent; `department` refused), and the answer is 201 with `result: "created"`. Someone who is not a contact has it (a vendor, a digital worker, a teammate off your domains): a 409 naming no one. A retry after a create updates, so the two sides read one body differently: send what each should do. Of two upserts of one new address at the same moment, the other may be a 409 whose `details[0].contact_ids` names the new contact; retry it to update. Needs contacts:create and contacts:update.



## OpenAPI

````yaml /api/statisfy-api.openapi.json put /v1/objects/contact/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/contact/records:
    put:
      tags:
        - contacts
      summary: Update the contact with an address, or create it
      description: >-
        `match=email` finds the contact by its address, whatever its case. A
        contact has it: the body less `email` is an update, with an update's
        rules (`accounts` replaces the list; a `name` sent beside parts is kept
        as sent; a portal user's name keys are a 422), and the answer is 200
        with `result: "updated"` (a body of the address alone writes nothing).
        Nobody has it: the body is a create, with a create's rules (`accounts`
        required; the name built from parts sent; `department` refused), and the
        answer is 201 with `result: "created"`. Someone who is not a contact has
        it (a vendor, a digital worker, a teammate off your domains): a 409
        naming no one. A retry after a create updates, so the two sides read one
        body differently: send what each should do. Of two upserts of one new
        address at the same moment, the other may be a 409 whose
        `details[0].contact_ids` names the new contact; retry it to update.
        Needs contacts:create and contacts:update.
      operationId: contacts_upsert
      parameters:
        - description: >-
            The key that finds the contact to update; its value comes from the
            body
          in: query
          name: match
          required: true
          schema:
            const: email
            type: string
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              properties:
                accounts:
                  default: null
                  description: >-
                    Required when the upsert creates; when it updates, replaces
                    the contact's accounts. Live account ids, the primary first
                  items:
                    type: string
                  title: Accounts
                  type: array
                department:
                  default: null
                  description: Applied when the upsert updates; a create refuses it
                  title: Department
                  type: string
                email:
                  default: null
                  description: 'Required: the contact''s email address'
                  title: Email
                  type: string
                fields:
                  anyOf:
                    - additionalProperties: true
                      type: object
                    - type: 'null'
                  default: null
                  description: Custom field keys to values
                  title: Fields
                first_name:
                  default: null
                  description: >-
                    A part of the name: when it or last_name is sent, the name
                    is built from the parts sent
                  title: First Name
                  type: string
                last_name:
                  default: null
                  description: >-
                    A part of the name: when it or first_name is sent, the name
                    is built from the parts sent
                  title: Last Name
                  type: string
                name:
                  default: null
                  description: >-
                    Required when the upsert creates (or first_name /
                    last_name); when it updates, the name as sent
                  title: Name
                  type: string
                role:
                  default: null
                  description: >-
                    The contact's buying role, such as Economic Buyer (your
                    workspace's People roles); free text
                  title: Role
                  type: string
                title:
                  default: null
                  description: The contact's job title
                  title: Title
                  type: string
              type: object
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpsertedContact'
          description: Successful Response
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpsertedContact'
          description: Created
      security:
        - HTTPBearer: []
components:
  schemas:
    UpsertedContact:
      properties:
        account:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The id of the contact's primary account; null when it has none (it
            may still be on accounts)
          title: Account
        accounts:
          description: The ids of every account the contact is on, the primary first
          items:
            type: string
          title: Accounts
          type: array
        crm_contact_id:
          anyOf:
            - type: string
            - type: 'null'
          description: The contact's id in your CRM
          title: Crm Contact Id
        department:
          anyOf:
            - type: string
            - type: 'null'
          title: Department
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        engagements:
          default: 0
          description: Engagements in the last 90 days
          title: Engagements
          type: integer
        fields:
          additionalProperties: true
          title: Fields
          type: object
        first_name:
          anyOf:
            - type: string
            - type: 'null'
          title: First Name
        id:
          title: Id
          type: string
        is_key_contact:
          default: false
          title: Is Key Contact
          type: boolean
        last_engagement_date:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            YYYY-MM-DD (UTC) of the latest engagement, at any time; null when
            none
          title: Last Engagement Date
        last_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Name
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        origin:
          anyOf:
            - enum:
                - crm
                - statisfy
              type: string
            - type: 'null'
          description: Where the contact first came from; null when not recorded
          title: Origin
        result:
          enum:
            - created
            - updated
          title: Result
          type: string
        role:
          anyOf:
            - type: string
            - type: 'null'
          title: Role
        sentiment:
          anyOf:
            - enum:
                - negative
                - neutral
                - positive
              type: string
            - type: 'null'
          description: null when none is recorded
          title: Sentiment
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
      required:
        - id
        - result
      title: UpsertedContact
      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.