> ## 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 matching account, or create it

> `match=crm_account_id` or `match=domain` names the body key that finds the account; a CRM id matches as stored or in its other Salesforce form (15 or 18 characters). One live account matches: it is updated and the answer is 200 with `result: "updated"`. None does: the body is a create and the answer is 201 with `result: "created"`. Several live accounts share the domain: 409 listing up to 10 of them. A CRM id a deleted account holds: 409. On the update side, `domain` must be one of the account's domains and `alias_domains` among them (409 otherwise; the API does not change them); `crm_account_id` must be the account's, or, on an account with none yet, one no other account holds, which is then set. A key describe marks read-only is accepted when its value equals what a read returns for it, in the same form, so the same full record can be sent every time. Retrying is safe: a retry after a create updates, but two upserts of one domain at the same moment can both create. Needs accounts:create and accounts:update. `name` and `domain` are required. `domain` is lowercased, then normalised as the app does it (protocol, `www.` and path removed). `domain`, `alias_domains` and `crm_account_id` can be set only when an account is created. Every other key is an update key, checked the same way: where describe marks `name` read-only (the workspace has not turned on account creation, or a sync such as a CRM or warehouse owns account names), a create is a 422 whose `details` mark `name` as `field_not_writable`. `type` defaults to Customer. A domain another live account holds, as its domain or an alias, is a 409 naming that account in `details[].account_ids`; so is a CRM id any account holds, a deleted one included, since a deleted account keeps its CRM id. The domain check matches exactly, so an older account stored with a domain in another case does not count, and two creates of one domain at the same moment can both succeed: run them one at a time, or match on `crm_account_id`.



## OpenAPI

````yaml /api/statisfy-api.openapi.json put /v1/objects/account/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/account/records:
    put:
      tags:
        - accounts
      summary: Update the matching account, or create it
      description: >-
        `match=crm_account_id` or `match=domain` names the body key that finds
        the account; a CRM id matches as stored or in its other Salesforce form
        (15 or 18 characters). One live account matches: it is updated and the
        answer is 200 with `result: "updated"`. None does: the body is a create
        and the answer is 201 with `result: "created"`. Several live accounts
        share the domain: 409 listing up to 10 of them. A CRM id a deleted
        account holds: 409. On the update side, `domain` must be one of the
        account's domains and `alias_domains` among them (409 otherwise; the API
        does not change them); `crm_account_id` must be the account's, or, on an
        account with none yet, one no other account holds, which is then set. A
        key describe marks read-only is accepted when its value equals what a
        read returns for it, in the same form, so the same full record can be
        sent every time. Retrying is safe: a retry after a create updates, but
        two upserts of one domain at the same moment can both create. Needs
        accounts:create and accounts:update. `name` and `domain` are required.
        `domain` is lowercased, then normalised as the app does it (protocol,
        `www.` and path removed). `domain`, `alias_domains` and `crm_account_id`
        can be set only when an account is created. Every other key is an update
        key, checked the same way: where describe marks `name` read-only (the
        workspace has not turned on account creation, or a sync such as a CRM or
        warehouse owns account names), a create is a 422 whose `details` mark
        `name` as `field_not_writable`. `type` defaults to Customer. A domain
        another live account holds, as its domain or an alias, is a 409 naming
        that account in `details[].account_ids`; so is a CRM id any account
        holds, a deleted one included, since a deleted account keeps its CRM id.
        The domain check matches exactly, so an older account stored with a
        domain in another case does not count, and two creates of one domain at
        the same moment can both succeed: run them one at a time, or match on
        `crm_account_id`.
      operationId: accounts_upsert
      parameters:
        - description: >-
            The key that finds the account to update; its value comes from the
            body
          in: query
          name: match
          required: true
          schema:
            enum:
              - crm_account_id
              - domain
            type: string
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: true
              properties:
                alias_domains:
                  default: null
                  description: Further domains of the account
                  items:
                    type: string
                  title: Alias Domains
                  type: array
                arr:
                  default: null
                  description: Annual recurring revenue, whole dollars
                  title: Arr
                  type: integer
                crm_account_id:
                  default: null
                  description: The account's id in your CRM
                  title: Crm Account Id
                  type: string
                domain:
                  default: null
                  description: >-
                    The account's web domain, e.g. acme.com; normalised and
                    lowercased
                  title: Domain
                  type: string
                fields:
                  anyOf:
                    - additionalProperties: true
                      type: object
                    - type: 'null'
                  default: null
                  description: Custom field keys to values
                  title: Fields
                name:
                  default: null
                  description: The account's name
                  title: Name
                  type: string
                renewal_date:
                  default: null
                  description: YYYY-MM-DD
                  format: date
                  title: Renewal Date
                  type: string
                type:
                  default: null
                  description: One of the account types describe lists
                  title: Type
                  type: string
              type: object
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpsertedAccount'
          description: Successful Response
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpsertedAccount'
          description: Created
      security:
        - HTTPBearer: []
components:
  schemas:
    UpsertedAccount:
      properties:
        account_summary__s_:
          anyOf:
            - type: string
            - type: 'null'
          title: Account Summary  S
        arr:
          anyOf:
            - type: integer
            - type: 'null'
          title: Arr
        crm_account_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Crm Account Id
        currency:
          anyOf:
            - type: string
            - type: 'null'
          title: Currency
        domain:
          anyOf:
            - type: string
            - type: 'null'
          title: Domain
        experience_health:
          anyOf:
            - type: string
            - type: 'null'
          title: Experience Health
        feature_requests_health:
          anyOf:
            - type: string
            - type: 'null'
          title: Feature Requests Health
        fields:
          additionalProperties: true
          title: Fields
          type: object
        health:
          anyOf:
            - type: string
            - type: 'null'
          title: Health
        health_summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Health Summary
        hierarchy:
          anyOf:
            - type: string
            - type: 'null'
          title: Hierarchy
        id:
          title: Id
          type: string
        last_activity_date:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Activity Date
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        outcomes_health:
          anyOf:
            - type: string
            - type: 'null'
          title: Outcomes Health
        owner_names:
          items:
            type: string
          title: Owner Names
          type: array
        owners:
          items:
            $ref: '#/components/schemas/AccountOwner'
          title: Owners
          type: array
        parent:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent
        product_usage_health:
          anyOf:
            - type: string
            - type: 'null'
          title: Product Usage Health
        relationship_health:
          anyOf:
            - type: string
            - type: 'null'
          title: Relationship Health
        renewal_date:
          anyOf:
            - type: string
            - type: 'null'
          title: Renewal Date
        result:
          enum:
            - created
            - updated
          title: Result
          type: string
        risks_health:
          anyOf:
            - type: string
            - type: 'null'
          title: Risks Health
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
      required:
        - id
        - result
      title: UpsertedAccount
      type: object
    AccountOwner:
      properties:
        field:
          anyOf:
            - type: string
            - type: 'null'
          title: Field
        role:
          anyOf:
            - type: string
            - type: 'null'
          title: Role
        source:
          anyOf:
            - type: string
            - type: 'null'
          title: Source
        user_id:
          title: User Id
          type: string
      required:
        - user_id
      title: AccountOwner
      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.