openapi: 3.1.0
info:
  title: Brand Contacts API
  version: v11
  description: Manage a contact list of people associated with partner accounts.
servers:
- url: https://api.impact.com
security:
- basicAuth: []
paths:
  /Advertisers/{AccountSID}/Campaigns/{CampaignId}/Contacts:
    get:
      operationId: listContacts
      tags:
      - Contacts
      summary: List all contacts
      parameters:
      - name: AccountSID
        in: path
        required: true
        schema:
          type: string
      - name: CampaignId
        in: path
        required: true
        schema:
          type: integer
      - name: AccountId
        in: query
        required: false
        schema:
          type: string
      - name: Title
        in: query
        required: false
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  Contacts:
                    type: array
                    items:
                      $ref: '#/components/schemas/Contact'
    post:
      operationId: createContact
      tags:
      - Contacts
      summary: Create a contact
      parameters:
      - name: AccountSID
        in: path
        required: true
        schema:
          type: string
      - name: CampaignId
        in: path
        required: true
        schema:
          type: integer
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CreateContactRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactResponse'
  /Advertisers/{AccountSID}/Campaigns/{CampaignId}/Contacts/{ContactId}:
    get:
      operationId: getContact
      tags:
      - Contacts
      summary: Retrieve a contact
      parameters:
      - name: AccountSID
        in: path
        required: true
        schema:
          type: string
      - name: CampaignId
        in: path
        required: true
        schema:
          type: integer
      - name: ContactId
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Contact'
    put:
      operationId: updateContact
      tags:
      - Contacts
      summary: Update a contact
      parameters:
      - name: AccountSID
        in: path
        required: true
        schema:
          type: string
      - name: CampaignId
        in: path
        required: true
        schema:
          type: integer
      - name: ContactId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/UpdateContactRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactResponse'
    delete:
      operationId: deleteContact
      tags:
      - Contacts
      summary: Delete a contact
      parameters:
      - name: AccountSID
        in: path
        required: true
        schema:
          type: string
      - name: CampaignId
        in: path
        required: true
        schema:
          type: integer
      - name: ContactId
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  Status:
                    type: string
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
    CreateContactRequest:
      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
          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
          example: VIP,Tier1
    UpdateContactRequest:
      type: object
      properties:
        FirstName:
          type: string
          example: Wile
        LastName:
          type: string
          example: Coyote
        EmailAddress:
          type: string
          example: wile.coyote@example.com
        Title:
          type: string
          example: Marketing Manager
        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.
        LabelsAdd:
          type: string
          example: VIP
        LabelsRemove:
          type: string
          example: Tier2
        AccountsAdd:
          type: string
          example: '12345'
        AccountsRemove:
          type: string
          example: '67890'
    ContactResponse:
      type: object
      properties:
        Status:
          type: string
          example: OK
        Uri:
          type: string
          format: uri-reference
          example: /Advertisers/<AccountSID>/Campaigns/1000/Contacts/2750
