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

# Upsert Contact By Email Or Phone Number

> Upsert a contact using email or phone number.
- **phone_number**: phone number of the contact including the country code. For ex: 16501111234
- **email**: email address of the contact.



## OpenAPI

````yaml https://api.insighto.ai/api/v1/openapi.json post /api/v1/contact/upsert
openapi: 3.1.0
info:
  title: Ragify
  version: v1
servers: []
security: []
paths:
  /api/v1/contact/upsert:
    post:
      tags:
        - Contact
      summary: Upsert Contact By Email Or Phone Number
      description: >-
        Upsert a contact using email or phone number.

        - **phone_number**: phone number of the contact including the country
        code. For ex: 16501111234

        - **email**: email address of the contact.
      operationId: upsert_contact_by_email_or_phone_number_api_v1_contact_upsert_post
      parameters:
        - name: first_name
          in: query
          required: true
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: First Name
        - name: last_name
          in: query
          required: true
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Last Name
        - name: email
          in: query
          required: true
          schema:
            anyOf:
              - type: string
                format: email
              - type: 'null'
            title: Email
        - name: phone_number
          in: query
          required: true
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Phone Number
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IPostResponseBase_IContactRead_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - Your API Key: []
        - HTTPBearer: []
components:
  schemas:
    IPostResponseBase_IContactRead_:
      properties:
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
          default: Data created successfully
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - {}
            - type: 'null'
          title: Meta
          default: {}
        data:
          anyOf:
            - $ref: '#/components/schemas/IContactRead'
            - type: 'null'
      type: object
      title: IPostResponseBase[IContactRead]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    IContactRead:
      properties:
        first_name:
          anyOf:
            - type: string
            - type: 'null'
          title: First Name
        last_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Name
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        channels:
          additionalProperties: true
          type: object
          title: Channels
          default: {}
        user_attributes:
          additionalProperties: true
          type: object
          title: User Attributes
          default: {}
        last_seen:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Seen
        last_sent:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Sent
        org_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Org Id
        first_assistant_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: First Assistant Id
        last_assistant_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Last Assistant Id
        first_widget_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: First Widget Id
        last_widget_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Last Widget Id
        custom_fields:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Custom Fields
          default: {}
        id:
          type: string
          format: uuid
          title: Id
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
      type: object
      required:
        - first_name
        - last_name
        - email
        - id
        - created_at
      title: IContactRead
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    Your API Key:
      type: apiKey
      description: >-
        Your API key for authentication. You can generate it from the
        **Settings** page. Format: starts with `in-`.
      in: query
      name: api_key
    HTTPBearer:
      type: http
      scheme: bearer

````