> ## 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.

# Update Person

> Per identifier type, `add` new values, `update` one in place (`to` fixes the value and keeps its history; `company_id`, `job_title` and `statuses` edit that identifier) and `remove` values. Removing one with history first returns 409 `would_delete_history`; send it again with `mode` `detach` (move it and its history to a new person) or `delete`. The last identifier cannot be removed. Names, `contact_status` and custom fields apply to the whole person. Everything happens in one transaction.



## OpenAPI

````yaml PATCH /public/people/{person_id}
openapi: 3.0.3
info:
  title: RevyOps API
  version: 1.0.0
servers:
  - url: https://app.revyops.com/api
security:
  - ApiKeyAuth: []
paths:
  /public/people/{person_id}:
    patch:
      tags:
        - public
      description: >-
        Per identifier type, `add` new values, `update` one in place (`to` fixes
        the value and keeps its history; `company_id`, `job_title` and
        `statuses` edit that identifier) and `remove` values. Removing one with
        history first returns 409 `would_delete_history`; send it again with
        `mode` `detach` (move it and its history to a new person) or `delete`.
        The last identifier cannot be removed. Names, `contact_status` and
        custom fields apply to the whole person. Everything happens in one
        transaction.
      operationId: Update person
      parameters:
        - in: path
          name: person_id
          schema:
            type: integer
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchedPersonPatch'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PatchedPersonPatch'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PatchedPersonPatch'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PersonWriteResponse'
          description: The person after the change.
        '400':
          description: Bad Request. `code` says why, `field` points at the value.
        '403':
          description: Forbidden. Missing, invalid or read-only API key.
        '404':
          description: Person, identifier or company not found.
        '409':
          description: >-
            `identifier_exists`, `identifier_changed`, `last_identifier`,
            `would_delete_history` or `person_gone`.
        '422':
          description: Custom field not in the schema.
components:
  schemas:
    PatchedPersonPatch:
      type: object
      properties:
        first_name:
          type: string
        last_name:
          type: string
        contact_status:
          type: string
        custom_fields:
          description: '[{"field_name", "field_value"}]; an empty value deletes.'
        merge:
          $ref: '#/components/schemas/Merge'
        emails:
          $ref: '#/components/schemas/IdentifierOps'
        linkedin_urls:
          $ref: '#/components/schemas/IdentifierOps'
        phones:
          $ref: '#/components/schemas/IdentifierOps'
    PersonWriteResponse:
      type: object
      properties:
        id:
          type: integer
        first_name:
          type: string
          nullable: true
        last_name:
          type: string
          nullable: true
        emails:
          type: array
          items:
            $ref: '#/components/schemas/PersonEmailItem'
        linkedin_urls:
          type: array
          items:
            $ref: '#/components/schemas/PersonIdentifierItem'
        phones:
          type: array
          items:
            $ref: '#/components/schemas/PersonPhoneItem'
        custom_fields:
          type: array
          items:
            $ref: '#/components/schemas/PersonPublicCustomField'
        created:
          type: boolean
        merged_person_ids:
          type: array
          items:
            type: integer
        detached_person_ids:
          type: array
          items:
            type: integer
          description: 'PATCH: the new people that detached identifiers moved to.'
      required:
        - custom_fields
        - emails
        - first_name
        - id
        - last_name
        - linkedin_urls
        - phones
    Merge:
      type: object
      properties:
        into_person_ids:
          type: array
          items:
            type: integer
            minimum: 1
          description: >-
            The existing_person_ids from the 409, to merge them into this
            person.
          minItems: 1
      required:
        - into_person_ids
    IdentifierOps:
      type: object
      properties:
        add:
          type: array
          items:
            $ref: '#/components/schemas/IdentifierItem'
        update:
          type: array
          items:
            $ref: '#/components/schemas/ChangeItem'
        remove:
          type: array
          items:
            $ref: '#/components/schemas/RemoveItem'
    PersonEmailItem:
      type: object
      properties:
        value:
          type: string
        company_id:
          type: integer
          nullable: true
        job_title:
          type: string
          nullable: true
        status:
          type: string
          nullable: true
        previous_status:
          type: string
          nullable: true
        first_campaign_email_sent:
          type: string
          format: date-time
          nullable: true
        last_campaign_email_sent:
          type: string
          format: date-time
          nullable: true
        last_reply_received:
          type: string
          format: date-time
          nullable: true
        origin:
          type: string
          nullable: true
        statuses:
          type: array
          items:
            $ref: '#/components/schemas/EmailSourceStatus'
          description: Each source's result for this email, newest check first.
      required:
        - company_id
        - first_campaign_email_sent
        - job_title
        - last_campaign_email_sent
        - last_reply_received
        - origin
        - previous_status
        - status
        - statuses
        - value
    PersonIdentifierItem:
      type: object
      properties:
        value:
          type: string
        company_id:
          type: integer
          nullable: true
        job_title:
          type: string
          nullable: true
        status:
          type: string
          nullable: true
        previous_status:
          type: string
          nullable: true
        first_campaign_email_sent:
          type: string
          format: date-time
          nullable: true
        last_campaign_email_sent:
          type: string
          format: date-time
          nullable: true
        last_reply_received:
          type: string
          format: date-time
          nullable: true
        origin:
          type: string
          nullable: true
      required:
        - company_id
        - first_campaign_email_sent
        - job_title
        - last_campaign_email_sent
        - last_reply_received
        - origin
        - previous_status
        - status
        - value
    PersonPhoneItem:
      type: object
      properties:
        value:
          type: string
        company_id:
          type: integer
          nullable: true
        job_title:
          type: string
          nullable: true
        status:
          type: string
          nullable: true
        previous_status:
          type: string
          nullable: true
        first_campaign_email_sent:
          type: string
          format: date-time
          nullable: true
        last_campaign_email_sent:
          type: string
          format: date-time
          nullable: true
        last_reply_received:
          type: string
          format: date-time
          nullable: true
        origin:
          type: string
          nullable: true
        phone_type:
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/PhoneTypeEnum'
            - $ref: '#/components/schemas/NullEnum'
      required:
        - company_id
        - first_campaign_email_sent
        - job_title
        - last_campaign_email_sent
        - last_reply_received
        - origin
        - phone_type
        - previous_status
        - status
        - value
    PersonPublicCustomField:
      type: object
      properties:
        id:
          type: integer
        updated_time:
          type: string
          format: date-time
        field_name:
          type: string
        field_value:
          type: string
      required:
        - field_name
        - field_value
        - id
        - updated_time
    IdentifierItem:
      type: object
      properties:
        value:
          type: string
        company_id:
          nullable: true
          description: Company id or domain.
        job_title:
          type: string
          nullable: true
        statuses:
          type: array
          items:
            $ref: '#/components/schemas/StatusItem'
          description: 'Emails only: one result per source.'
        phone_type:
          nullable: true
          description: >-
            Phones only: office, mobile, home, direct, fax, url, other. null
            clears it.


            * `office` - Office

            * `mobile` - Mobile

            * `home` - Home

            * `direct` - Direct

            * `fax` - Fax

            * `url` - URL

            * `other` - Other
          oneOf:
            - $ref: '#/components/schemas/PhoneTypeEnum'
            - $ref: '#/components/schemas/BlankEnum'
            - $ref: '#/components/schemas/NullEnum'
      required:
        - value
    ChangeItem:
      type: object
      properties:
        value:
          type: string
        company_id:
          nullable: true
          description: Company id or domain.
        job_title:
          type: string
          nullable: true
        statuses:
          type: array
          items:
            $ref: '#/components/schemas/StatusItem'
          description: 'Emails only: one result per source.'
        phone_type:
          nullable: true
          description: >-
            Phones only: office, mobile, home, direct, fax, url, other. null
            clears it.


            * `office` - Office

            * `mobile` - Mobile

            * `home` - Home

            * `direct` - Direct

            * `fax` - Fax

            * `url` - URL

            * `other` - Other
          oneOf:
            - $ref: '#/components/schemas/PhoneTypeEnum'
            - $ref: '#/components/schemas/BlankEnum'
            - $ref: '#/components/schemas/NullEnum'
        to:
          type: string
          description: The corrected value; the identifier keeps its history.
      required:
        - value
    RemoveItem:
      type: object
      properties:
        value:
          type: string
        mode:
          allOf:
            - $ref: '#/components/schemas/ModeEnum'
          description: |-
            Needed when the identifier has history: `detach` or `delete`.

            * `detach` - detach
            * `delete` - delete
      required:
        - value
    EmailSourceStatus:
      type: object
      properties:
        source:
          type: string
          description: >-
            Who reported the result: an integration, `api`, `revyops` for a hand
            edit in the app, or a source the workspace added.
        status:
          type: string
          description: >-
            One of: valid, invalid, risky, catchall, unknown, bounced,
            unsubscribed.
        raw_value:
          type: string
          nullable: true
          description: The tool's own word for the result, when it had one.
        live:
          type: boolean
          description: >-
            True for a real send, bounce, unsubscribe or hand edit; false for a
            check.
        observed_at:
          type: string
          format: date-time
          description: When this source last checked the email.
        status_changed_at:
          type: string
          format: date-time
          description: When this source's result last changed.
      required:
        - live
        - observed_at
        - raw_value
        - source
        - status
        - status_changed_at
    PhoneTypeEnum:
      enum:
        - office
        - mobile
        - home
        - direct
        - fax
        - url
        - other
      type: string
      description: |-
        * `office` - Office
        * `mobile` - Mobile
        * `home` - Home
        * `direct` - Direct
        * `fax` - Fax
        * `url` - URL
        * `other` - Other
    NullEnum:
      enum:
        - null
    StatusItem:
      type: object
      properties:
        source:
          type: string
          description: >-
            The tool that checked the email, such as `millionverifier`, or
            `api`.
        status:
          type: string
          description: >-
            One of: valid, invalid, risky, catchall, unknown, bounced,
            unsubscribed.
        raw_value:
          type: string
          nullable: true
          description: The tool's own word.
        observed_at:
          type: string
          format: date-time
          description: When the source checked the email, with a timezone.
        live:
          type: boolean
          default: false
          description: True for a real send, bounce or reply rather than a check.
      required:
        - observed_at
        - source
        - status
    BlankEnum:
      enum:
        - ''
    ModeEnum:
      enum:
        - detach
        - delete
      type: string
      description: |-
        * `detach` - detach
        * `delete` - delete
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.