openapi: 3.1.0
info:
  title: Brand API - Contacts
  description: API for managing contacts associated with partner accounts in your program.
  version: v12
servers:
- url: https://api.impact.com
security:
- basicAuth: []
paths:
  /Advertisers/{AccountSID}/Campaigns/{CampaignId}/Contacts:
    get:
      summary: List Contacts
      description: Returns a list of your contacts for a specific campaign.
      operationId: listContacts
      tags:
      - Contacts
      parameters:
      - name: AccountSID
        in: path
        required: true
        schema:
          type: string
        description: The unique identifier for the account.
      - name: CampaignId
        in: path
        required: true
        schema:
          type: integer
        description: The ID of the campaign (program) the contacts belong to.
      - name: AccountId
        in: query
        schema:
          type: string
        description: Filter contacts by a specific partner account ID.
      - name: Title
        in: query
        schema:
          type: string
        description: Filter contacts by their title.
      responses:
        '200':
          description: An array of contact objects.
          content:
            application/json:
              schema:
                type: object
                properties:
                  Contacts:
                    type: array
                    items:
                      $ref: '#/components/schemas/Contact'
    post:
      summary: Create a Contact
      description: Creates a new contact and associates them with partner accounts.
      operationId: createContact
      tags:
      - Contacts
      parameters:
      - name: AccountSID
        in: path
        required: true
        schema:
          type: string
        description: The unique identifier for the account.
      - name: CampaignId
        in: path
        required: true
        schema:
          type: integer
        description: The ID of the campaign (program) to create the contact in.
      requestBody:
        description: Contact information. Use multipart/form-data for profile image file uploads.
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/ContactCreate'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ContactCreate'
      responses:
        '200':
          description: The contact was successfully created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  Status:
                    type: string
                    example: OK
                  Uri:
                    type: string
  /Advertisers/{AccountSID}/Campaigns/{CampaignId}/Contacts/{ContactId}:
    get:
      summary: Retrieve a Contact
      description: Retrieves the details of an existing contact.
      operationId: getContactById
      tags:
      - Contacts
      parameters:
      - name: AccountSID
        in: path
        required: true
        schema:
          type: string
        description: The unique identifier for the account.
      - name: CampaignId
        in: path
        required: true
        schema:
          type: integer
        description: The ID of the campaign (program) the contact belongs to.
      - name: ContactId
        in: path
        required: true
        schema:
          type: string
        description: The unique impact.com ID for the contact.
      responses:
        '200':
          description: A contact object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Contact'
    put:
      summary: Update a Contact
      description: Updates the specified contact. Editable - false contacts can only have Labels updated.
      operationId: updateContact
      tags:
      - Contacts
      parameters:
      - name: AccountSID
        in: path
        required: true
        schema:
          type: string
        description: The unique identifier for the account.
      - name: CampaignId
        in: path
        required: true
        schema:
          type: integer
        description: The ID of the campaign (program) the contact belongs to.
      - name: ContactId
        in: path
        required: true
        schema:
          type: string
        description: The unique impact.com ID for the contact to update.
      requestBody:
        description: Fields to update for the contact. Use multipart/form-data for file uploads.
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/ContactUpdate'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ContactUpdate'
      responses:
        '200':
          description: The contact was successfully updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  Status:
                    type: string
                    example: OK
                  Uri:
                    type: string
    delete:
      summary: Delete a Contact
      description: Permanently deletes a user-created contact (Editable - true). This cannot be undone.
      operationId: deleteContact
      tags:
      - Contacts
      parameters:
      - name: AccountSID
        in: path
        required: true
        schema:
          type: string
        description: The unique identifier for the account.
      - name: CampaignId
        in: path
        required: true
        schema:
          type: integer
        description: The ID of the campaign (program) the contact belongs to.
      - name: ContactId
        in: path
        required: true
        schema:
          type: string
        description: The unique impact.com ID for the contact to delete.
      responses:
        '200':
          description: The contact was successfully deleted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  Status:
                    type: string
                    example: DELETED
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
  schemas:
    Contact:
      type: object
      properties:
        Id:
          type: string
          example: '2750'
          description: Unique Contact ID. System-created contacts are prefixed with 'M'.
        FirstName:
          type: string
          example: Wile
        LastName:
          type: string
          example: Coyote
        EmailAddress:
          type: string
          format: email
          example: wile.coyote@example.com
        Title:
          type: string
          example: ''
        ProfileImage:
          type: string
          format: uri-reference
          example: /Advertisers/<AccountSID>/Campaigns/1000/Contacts/2750/ProfileImage
        WorkPhoneNumberCountry:
          type: string
          example: US
        WorkPhoneNumber:
          type: string
          example: '8051234567'
        CellphoneNumberCountry:
          type: string
          example: US
        CellphoneNumber:
          type: string
          example: '8059876543'
        Editable:
          type: boolean
          example: false
        Labels:
          type: array
          items:
            type: string
        Accounts:
          type: array
          items:
            type: object
            properties:
              Id:
                type: string
              Name:
                type: string
        Uri:
          type: string
          format: uri-reference
          example: /Advertisers/<AccountSID>/Campaigns/1000/Contacts/2750
    ContactCreate:
      type: object
      required:
      - FirstName
      - LastName
      - EmailAddress
      - Accounts
      properties:
        FirstName:
          type: string
          example: Wile
        LastName:
          type: string
          example: Coyote
        EmailAddress:
          type: string
          format: email
          example: wile.coyote@example.com
        Accounts:
          type: string
          description: A comma-separated string of partner account Ids.
          example: 12345,67890
        Title:
          type: string
          example: Marketing Manager
        ProfileImageUrl:
          type: string
          format: uri
          example: https://example.com/profile.jpg
        ProfileImageFile:
          type: string
          format: binary
          description: Image file to upload.
        WorkPhoneNumber:
          type: string
          example: '8051234567'
        WorkPhoneNumberCountry:
          type: string
          example: US
        CellphoneNumber:
          type: string
          example: '8059876543'
        CellphoneNumberCountry:
          type: string
          example: US
        Labels:
          type: string
          description: A comma-separated string of labels.
          example: VIP,Tier1
    ContactUpdate:
      type: object
      properties:
        FirstName:
          type: string
          example: Wile
        LastName:
          type: string
          example: Coyote
        EmailAddress:
          type: string
          format: email
          example: wile.coyote@example.com
        Title:
          type: string
          example: Marketing Manager
        ProfileImageUrl:
          type: string
          format: uri
          example: https://example.com/profile.jpg
        ProfileImageFile:
          type: string
          format: binary
        WorkPhoneNumber:
          type: string
          example: '8051234567'
          description: The contact's work phone number. Requires `WorkPhoneNumberCountry` if updated.
        WorkPhoneNumberCountry:
          type: string
          example: US
          description: Two-letter ISO 3166-1 alpha-2 country code. Required when `WorkPhoneNumber` is updated.
        CellphoneNumber:
          type: string
          example: '8059876543'
          description: The contact's cellphone number. Requires `CellphoneNumberCountry` if updated.
        CellphoneNumberCountry:
          type: string
          example: US
          description: Two-letter ISO 3166-1 alpha-2 country code. Required when `CellphoneNumber` is updated.
        LabelsAdd:
          type: string
          description: Comma-separated labels to add.
          example: VIP
        LabelsRemove:
          type: string
          description: Comma-separated labels to remove.
          example: Tier2
        AccountsAdd:
          type: string
          description: Comma-separated account IDs to associate.
          example: '12345'
        AccountsRemove:
          type: string
          description: Comma-separated account IDs to disassociate.
          example: '67890'
