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

# Upsert a contact

> Asynchronously creates or updates a contact in the Qomon database. See the upsert rules in the documentation.



## OpenAPI

````yaml /src/autogen/incoming-openapi3.0.yaml post /contacts/upsert
openapi: 3.1.0
info:
  description: >-
    This OpenAPI 3.1 specification describes the public API of the Qomon
    platform. It is generated from the code and serves both as documentation for
    API consumers and as a contract for future development.
  title: Qomon API Reference
  version: 0.0.1
servers:
  - description: Production
    url: https://incoming.qomon.app
security:
  - bearerAuth: []
tags:
  - description: >-
      Create, read, update, and delete Qomon contacts.


      **Basic fields:** name, email, phone, address, tags, gender, birthdate,
      etc.


      **Advanced fields:** consents, surveys, custom fields, level of support,
      tasks.


      **Operations:**

      - `/contacts/upsert` (async) — Recommended for synchronizing and
      mass-updating contacts

      - `/contacts` (sync) — Create individual contacts

      - `/contacts/{id}` (sync) — Read, update, or delete individual contacts
    name: Contacts
  - description: >-
      Retrieve form definitions and their possible values (refvalues).


      **Use forms to:**

      - Understand and interpret contact advanced fields

      - Look up valid values for consents, surveys, custom fields, task
      assignments

      - Explore available form types and their structure


      **Form types:** consent, level_of_support, presence_status, custom_fields,
      survey, tasks
    name: Forms
paths:
  /contacts/upsert:
    post:
      tags:
        - Contacts
      summary: Upsert a contact
      description: >-
        Asynchronously creates or updates a contact in the Qomon database. See
        the upsert rules in the documentation.
      operationId: upsert-contact
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactUpsertEnvelope'
        required: true
      responses:
        '202':
          description: Accepted
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
components:
  schemas:
    ContactUpsertEnvelope:
      additionalProperties: true
      properties:
        data:
          $ref: '#/components/schemas/ContactUpsertData'
          description: Contact payload to create or update asynchronously.
        kind:
          description: Resource kind.
          enum:
            - contact
          examples:
            - contact
          type: string
      required:
        - kind
        - data
      type: object
    ErrorModel:
      additionalProperties: true
      properties:
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
      type: object
    ContactUpsertData:
      additionalProperties: true
      properties:
        actions:
          description: Task values by form ID or label.
          items:
            $ref: '#/components/schemas/ContactUpsertSelection'
          type:
            - array
            - 'null'
        address:
          $ref: '#/components/schemas/ContactUpsertAddress'
          description: Postal address.
        age_category:
          description: Internal age-category identifier.
          format: int64
          type: integer
        birthcity:
          description: Birth city.
          type: string
        birthcountry:
          description: Birth country.
          type: string
        birthdate:
          description: Birthdate.
          type: string
        birthdept:
          description: Birth department.
          type: string
        black_list:
          description: Whether the contact is blacklisted.
          type: boolean
        consents:
          description: Consent values by form ID or label.
          items:
            $ref: '#/components/schemas/ContactUpsertSelection'
          type:
            - array
            - 'null'
        custom_fields:
          description: Custom field values by form ID or label.
          items:
            $ref: '#/components/schemas/ContactUpsertSelection'
          type:
            - array
            - 'null'
        external_id:
          description: External system identifier used for upsert matching.
          type: string
        firstname:
          description: First name.
          examples:
            - Jane
          type: string
        forms:
          description: Survey values by form ID or label.
          items:
            $ref: '#/components/schemas/ContactUpsertSelection'
          type:
            - array
            - 'null'
        gender:
          description: Gender.
          enum:
            - M
            - F
            - O
          examples:
            - F
          type: string
        id:
          description: Existing contact ID to update.
          examples:
            - 42
          format: int64
          minimum: 0
          type: integer
        mail:
          description: Email address.
          examples:
            - jane@example.com
          format: email
          type: string
        married_name:
          description: Married name.
          examples:
            - Smith
          type: string
        mobile:
          description: Mobile phone number.
          type: string
        name_presences:
          description: Presence-status values by form ID or label.
          items:
            $ref: '#/components/schemas/ContactUpsertSelection'
          type:
            - array
            - 'null'
        nationality:
          description: Nationality.
          type: string
        nationbuilderid:
          description: Legacy NationBuilder identifier.
          format: int64
          type: integer
        notes:
          description: Notes to attach to the contact.
          items:
            $ref: '#/components/schemas/ContactUpsertNote'
          type:
            - array
            - 'null'
        phone:
          description: Landline phone number.
          type: string
        status:
          description: Level-of-support values by form ID or label.
          items:
            $ref: '#/components/schemas/ContactUpsertSelection'
          type:
            - array
            - 'null'
        surname:
          description: Last name.
          examples:
            - Doe
          type: string
        tags:
          description: Tags attached to the contact.
          items:
            $ref: '#/components/schemas/Tag'
          type:
            - array
            - 'null'
      type: object
    ErrorDetail:
      additionalProperties: true
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    ContactUpsertSelection:
      additionalProperties: true
      properties:
        id:
          description: Form or refvalue ID.
          format: int64
          minimum: 0
          type: integer
        label:
          description: Form or refvalue label.
          type: string
        value:
          description: Submitted value.
          type: string
      type: object
    ContactUpsertAddress:
      additionalProperties: true
      properties:
        addition:
          description: Additional address line.
          type: string
        building:
          description: Building identifier.
          type: string
        city:
          description: City.
          type: string
        citycode:
          description: City code.
          type: string
        country:
          description: Country.
          type: string
        county:
          description: County or department.
          type: string
        door:
          description: Door or apartment identifier.
          type: string
        floor:
          description: Floor.
          type: string
        housenumber:
          description: House number.
          type: string
        id:
          description: Existing address ID to update.
          format: int64
          minimum: 0
          type: integer
        infos:
          description: Extra address information.
          type: string
        latitude:
          description: Latitude coordinate.
          type: string
        longitude:
          description: Longitude coordinate.
          type: string
        pollingstation:
          description: Polling station.
          type: string
        postalcode:
          description: Postal code.
          type: string
        state:
          description: State or region.
          type: string
        street:
          description: Street name.
          type: string
      type: object
    ContactUpsertNote:
      additionalProperties: true
      properties:
        content:
          description: Note content.
          type: string
        id:
          description: Existing note ID to update.
          format: int64
          minimum: 0
          type: integer
        pinned:
          description: Whether the note is pinned.
          type: boolean
      required:
        - content
      type: object
    Tag:
      additionalProperties: true
      properties:
        name:
          description: Tag label.
          examples:
            - volunteer
          type: string
      required:
        - name
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: opaque
      description: >-
        OAuth2 access token. Pass the token in the Authorization header as
        `Bearer <token>`. The token is looked up in Redis to resolve the caller
        identity.
      scheme: bearer
      type: http

````