openapi: 3.1.0
info:
  title: Brand API - Partner Notes
  description: API for managing internal notes about partners, including text content and file attachments.
  version: v12
servers:
- url: https://api.impact.com
paths:
  /Advertisers/{AccountSID}/Campaigns/{CampaignId}/Notes:
    get:
      summary: List All Notes
      description: Returns a list of notes for a specific campaign, with options for filtering by partner and date.
      operationId: listNotes
      tags:
      - Notes
      parameters:
      - name: AccountSID
        in: path
        required: true
        schema:
          type: string
        description: Your unique Account SID.
      - name: CampaignId
        in: path
        required: true
        schema:
          type: integer
        description: The ID of the campaign the notes belong to.
      - name: MediaId
        in: query
        schema:
          type: integer
        description: Filter notes for a specific partner account ID.
      - name: StartDate
        in: query
        schema:
          type: string
          format: date-time
        description: The start of the date range to filter notes by their creation date.
      - name: EndDate
        in: query
        schema:
          type: string
          format: date-time
        description: The end of the date range to filter notes by their creation date.
      responses:
        '200':
          description: A paginated list of note objects.
          content:
            application/json:
              schema:
                type: object
                properties:
                  Notes:
                    type: array
                    description: The list of note objects.
                    items:
                      $ref: '#/components/schemas/Note'
    post:
      summary: Create a Note
      description: Creates a new note for a partner. Either `Content` or an `Attachment` is required.
      operationId: createNote
      tags:
      - Notes
      parameters:
      - name: AccountSID
        in: path
        required: true
        schema:
          type: string
        description: Your unique Account SID.
      - name: CampaignId
        in: path
        required: true
        schema:
          type: integer
        description: The ID of the campaign to create the note in.
      requestBody:
        description: Note content and/or attachments.
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
              - MediaId
              properties:
                MediaId:
                  type: integer
                  description: The partner account ID this note is for.
                  example: 10000
                Content:
                  type: string
                  description: The plaintext content of the note. Optional if an Attachment is provided.
                  example: Following up on this partner.
                Type:
                  $ref: '#/components/schemas/NoteType'
                  description: The interaction type for this note.
                Attachment:
                  type: string
                  format: binary
                  description: An image file to attach to the note.
      responses:
        '200':
          $ref: '#/components/responses/SuccessUriResponse'
  /Advertisers/{AccountSID}/Campaigns/{CampaignId}/Notes/{NoteId}:
    get:
      summary: Retrieve a Note
      description: Retrieves the details of a single, existing note by its unique ID.
      operationId: getNoteById
      tags:
      - Notes
      parameters:
      - name: AccountSID
        in: path
        required: true
        description: The unique identifier for the account.
        schema:
          type: string
      - name: CampaignId
        in: path
        required: true
        description: The ID of the campaign the note belongs to.
        schema:
          type: integer
      - name: NoteId
        in: path
        required: true
        description: The unique identifier for the note.
        schema:
          type: integer
      responses:
        '200':
          description: A single note object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Note'
    put:
      summary: Update a Note
      description: Updates the specified note, allowing for changes to content and attachments.
      operationId: updateNote
      tags:
      - Notes
      parameters:
      - name: AccountSID
        in: path
        required: true
        description: The unique identifier for the account.
        schema:
          type: string
      - name: CampaignId
        in: path
        required: true
        description: The ID of the campaign the note belongs to.
        schema:
          type: integer
      - name: NoteId
        in: path
        required: true
        description: The unique identifier for the note.
        schema:
          type: integer
      requestBody:
        description: The fields to update.
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                Content:
                  type: string
                  description: The new plaintext content for the note.
                  example: Updated note content.
                Type:
                  $ref: '#/components/schemas/NoteType'
                  description: The interaction type for this note.
                AttachmentsAdd:
                  type: string
                  format: binary
                  description: A new image file to attach.
                AttachmentsRemove:
                  type: string
                  description: The name of an existing attachment to remove.
                  example: 1,2
      responses:
        '200':
          $ref: '#/components/responses/SuccessUriResponse'
    delete:
      summary: Delete a Note
      description: Permanently deletes a note. This cannot be undone.
      operationId: deleteNote
      tags:
      - Notes
      parameters:
      - name: AccountSID
        in: path
        required: true
        description: The unique identifier for the account.
        schema:
          type: string
      - name: CampaignId
        in: path
        required: true
        description: The ID of the campaign the note belongs to.
        schema:
          type: integer
      - name: NoteId
        in: path
        required: true
        description: The unique identifier for the note.
        schema:
          type: integer
      responses:
        '200':
          $ref: '#/components/responses/SuccessDeleteResponse'
components:
  schemas:
    Note:
      type: object
      properties:
        Id:
          type: integer
          description: The unique identifier for the note.
          example: 123456
        MediaId:
          type: integer
          description: The unique identifier of the partner this note is about.
          example: 10000
        MediaName:
          type: string
          description: The display name of the partner this note is about.
          example: Acme Partner
        Creator:
          type: string
          description: The name of the user who created the note.
          example: Brand Man
        CreationDate:
          type: string
          format: date-time
          description: The date and time the note was created.
          example: '2020-09-10T10:51:23-07:00'
        ModificationDate:
          type: string
          format: date-time
          description: The date and time the note was last modified.
          example: '2020-10-21T14:51:42-07:00'
        Content:
          type: string
          description: The plaintext content of the note.
          example: Meep Meep
        Type:
          $ref: '#/components/schemas/NoteType'
          description: The interaction type for this note.
        Attachments:
          type: array
          description: URIs of file attachments associated with the note.
          items:
            type: string
            format: uri-reference
            example: /Advertisers/<AccountSID>/Campaigns/1000/Notes/2750/Attachments/1
        Uri:
          type: string
          format: uri-reference
          description: The unique reference to this note in the impact.com API.
          example: /Advertisers/<AccountSID>/Campaigns/1000/Notes/123456
    NoteType:
      type: string
      enum:
      - EMAIL
      - IM
      - NONE
      - PHONE
  responses:
    SuccessUriResponse:
      description: The request was successful.
      content:
        application/json:
          schema:
            type: object
            properties:
              Status:
                type: string
                description: Indicates whether the operation was successful.
                example: OK
              Uri:
                type: string
                format: uri-reference
                description: The unique reference to the affected note.
    SuccessDeleteResponse:
      description: The resource was successfully deleted.
      content:
        application/json:
          schema:
            type: object
            properties:
              Status:
                type: string
                description: Indicates that the note was deleted.
                example: DELETED
