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

# Create or Update Contact

> Creates or updates contacts using email, LinkedIn URL, phone, or multiple identifiers as the lookup key. If a contact with a given identifier exists for this client, it will be updated. Otherwise, a new contact is created. company_id accepts an integer ID or a domain string to auto-resolve the company.



## OpenAPI

````yaml PUT /public/v2/contacts
openapi: 3.0.3
info:
  title: RevyOps API
  version: 1.0.0
servers:
  - url: https://app.revyops.com/api
security:
  - ApiKeyAuth: []
paths:
  /public/v2/contacts:
    put:
      tags:
        - public
      description: >-
        Creates or updates contacts using email, LinkedIn URL, phone, or
        multiple identifiers as the lookup key. If a contact with a given
        identifier exists for this client, it will be updated. Otherwise, a new
        contact is created. company_id accepts an integer ID or a domain string
        to auto-resolve the company.
      operationId: Upsert contact (v2)
      parameters:
        - in: query
          name: email
          schema:
            type: string
          description: >-
            Email to look up. If a contact with this email exists it will be
            updated; otherwise a new contact is created. Provide only one of
            email, linkedin_url, or phone.
        - in: query
          name: linkedin_url
          schema:
            type: string
          description: >-
            LinkedIn URL to look up. If a contact with this LinkedIn URL exists
            it will be updated; otherwise a new contact is created. Provide only
            one of email, linkedin_url, or phone.
        - in: query
          name: phone
          schema:
            type: string
          description: >-
            Phone number (E.164) to look up. If a contact with this phone exists
            it will be updated; otherwise a new contact is created. Provide only
            one of email, linkedin_url, or phone.
        - in: query
          name: structure
          schema:
            type: string
            enum:
              - FLAT
              - NESTED
            default: NESTED
          description: >-
            Format of custom fields in response. NESTED returns array of objects
            with id, field_name, field_value. FLAT returns object with field
            names as keys.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactV2'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/ContactV2'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ContactV2'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactV2'
          description: OK. The contact already existed and was updated.
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactV2'
          description: Created. The contact did not exist and was created.
        '400':
          description: Bad Request. Invalid data or missing/conflicting query parameters.
        '401':
          description: Unauthorized. Company does not belong to this client.
        '403':
          description: Forbidden. Missing authentication credentials or invalid API key.
        '409':
          description: >-
            Conflict. A contact with this identifier already exists for this
            client.
        '422':
          description: >-
            Unprocessable Entity. Custom field(s) not defined in the master
            schema.
        '500':
          description: Internal Server Error. An unexpected error occurred on the server.
components:
  schemas:
    ContactV2:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        updated_time:
          type: string
          format: date-time
          readOnly: true
        email:
          type: string
          nullable: true
        linkedin_url:
          type: string
          nullable: true
        phone:
          type: string
          nullable: true
        first_name:
          type: string
        last_name:
          type: string
        job_title:
          type: string
          nullable: true
        company_id:
          type: integer
          nullable: true
        contact_custom_fields:
          type: string
          readOnly: true
        contact_custom_fields_input:
          type: array
          items:
            $ref: '#/components/schemas/ContactCustomFields'
          writeOnly: true
        origin:
          type: string
        first_campaign_email_sent:
          type: string
          format: date-time
          readOnly: true
        last_campaign_email_sent:
          type: string
          format: date-time
          readOnly: true
        last_reply_received:
          type: string
          format: date-time
          readOnly: true
        contact_status:
          type: string
        previous_status:
          type: string
          readOnly: true
          nullable: true
        status_changed_at:
          type: string
          format: date-time
          readOnly: true
          nullable: true
        do_not_contact:
          type: string
          nullable: true
        total_linkedin_messages_sent:
          type: integer
          readOnly: true
          default: 0
        first_linkedin_message_sent:
          type: string
          format: date-time
          readOnly: true
        last_linkedin_message_sent:
          type: string
          format: date-time
          readOnly: true
        total_linkedin_message_replies:
          type: integer
          readOnly: true
          default: 0
        last_linkedin_message_reply_received:
          type: string
          format: date-time
          readOnly: true
        interested_linkedin_message_replies:
          type: integer
          readOnly: true
          default: 0
        total_linkedin_inmails_sent:
          type: integer
          readOnly: true
          default: 0
        first_linkedin_inmail_sent:
          type: string
          format: date-time
          readOnly: true
        last_linkedin_inmail_sent:
          type: string
          format: date-time
          readOnly: true
        total_linkedin_inmail_replies:
          type: integer
          readOnly: true
          default: 0
        last_linkedin_inmail_reply_received:
          type: string
          format: date-time
          readOnly: true
        interested_linkedin_inmail_replies:
          type: integer
          readOnly: true
          default: 0
        total_linkedin_connection_requests_sent:
          type: integer
          readOnly: true
          default: 0
        first_linkedin_connection_request_sent:
          type: string
          format: date-time
          readOnly: true
        last_linkedin_connection_request_sent:
          type: string
          format: date-time
          readOnly: true
        total_linkedin_connections_accepted:
          type: integer
          readOnly: true
          default: 0
        first_linkedin_connection_accepted:
          type: string
          format: date-time
          readOnly: true
        last_linkedin_connection_accepted:
          type: string
          format: date-time
          readOnly: true
      required:
        - contact_custom_fields
        - first_campaign_email_sent
        - first_linkedin_connection_accepted
        - first_linkedin_connection_request_sent
        - first_linkedin_inmail_sent
        - first_linkedin_message_sent
        - id
        - interested_linkedin_inmail_replies
        - interested_linkedin_message_replies
        - last_campaign_email_sent
        - last_linkedin_connection_accepted
        - last_linkedin_connection_request_sent
        - last_linkedin_inmail_reply_received
        - last_linkedin_inmail_sent
        - last_linkedin_message_reply_received
        - last_linkedin_message_sent
        - last_reply_received
        - previous_status
        - status_changed_at
        - total_linkedin_connection_requests_sent
        - total_linkedin_connections_accepted
        - total_linkedin_inmail_replies
        - total_linkedin_inmails_sent
        - total_linkedin_message_replies
        - total_linkedin_messages_sent
        - updated_time
    ContactCustomFields:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        updated_time:
          type: string
          format: date-time
          readOnly: true
        field_name:
          type: string
        field_value:
          type: string
          maxLength: 2500
      required:
        - field_name
        - field_value
        - id
        - updated_time
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````