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

# Upsert Contact



## OpenAPI

````yaml api-reference/openapi.json POST /contacts/upsert
openapi: 3.0.1
info:
  title: Sendrealm API
  description: >-
    API for email, push, audience resources, domains, campaign drafts,
    templates, events, topics, and automations
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.sendrealm.com
security:
  - bearerAuth: []
paths:
  /contacts/upsert:
    post:
      summary: Create or merge-update a contact by email
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - email
              properties:
                email:
                  type: string
                  format: email
                fields:
                  type: object
                  additionalProperties:
                    $ref: '#/components/schemas/JsonValue'
      responses:
        '200':
          description: Upserted contact
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactUpsertResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    JsonValue:
      oneOf:
        - type: string
          nullable: true
        - type: number
        - type: boolean
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/JsonValue'
        - type: array
          items:
            $ref: '#/components/schemas/JsonValue'
    ContactUpsertResponse:
      type: object
      required:
        - status
        - data
      properties:
        status:
          type: integer
          description: HTTP response status code
        data:
          $ref: '#/components/schemas/ContactUpsert'
    ContactUpsert:
      allOf:
        - $ref: '#/components/schemas/Contact'
        - type: object
          required:
            - created
          properties:
            created:
              type: boolean
    Error:
      type: object
      required:
        - status
        - error
      properties:
        status:
          type: integer
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details:
              $ref: '#/components/schemas/JsonValue'
            issues:
              type: array
              items:
                $ref: '#/components/schemas/ValidationIssue'
    Contact:
      type: object
      properties:
        id:
          type: string
          format: uuid
        email:
          type: string
          format: email
        fields:
          $ref: '#/components/schemas/ContactFields'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    ValidationIssue:
      type: object
      required:
        - code
        - path
        - message
      properties:
        code:
          type: string
        path:
          type: string
          nullable: true
        message:
          type: string
    ContactFields:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/JsonPrimitive'
    JsonPrimitive:
      oneOf:
        - type: string
          nullable: true
        - type: number
        - type: boolean
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````