openapi: 3.1.0
info:
  title: Brand Partner Groups API
  version: v11
  description: "Manage private partner groups used to organize and label partners within your account. \nPartner groups are internal and not visible to the partners themselves.\n"
servers:
- url: https://api.impact.com
security:
- basicAuth: []
paths:
  /Advertisers/{AccountSID}/Campaigns/{CampaignId}/MediaPartnerGroups:
    get:
      operationId: listPartnerGroups
      tags:
      - Partner Groups
      summary: List all partner groups
      description: Returns a list of all partner groups associated with the specified campaign.
      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 to retrieve partner groups from.
        schema:
          type: integer
      responses:
        '200':
          description: A list of partner group objects.
          content:
            application/json:
              schema:
                type: object
                properties:
                  Groups:
                    type: array
                    description: The list of partner group objects.
                    items:
                      $ref: '#/components/schemas/PartnerGroup'
    post:
      operationId: createPartnerGroup
      tags:
      - Partner Groups
      summary: Create a partner group
      description: Creates a new private partner group for organizing partners.
      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 to create the group in.
        schema:
          type: integer
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
              - Name
              properties:
                Name:
                  type: string
                  description: The display name for the partner group.
                  example: Acme Top Partners
                MediaPartners:
                  type: string
                  description: Comma-separated list of MediaPartnerId values to add.
                  example: 2552842,2552843
      responses:
        '200':
          description: The partner group was created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartnerGroupStatusResponse'
  /Advertisers/{AccountSID}/Campaigns/{CampaignId}/MediaPartnerGroups/{PartnerGroupId}:
    get:
      operationId: getPartnerGroup
      tags:
      - Partner Groups
      summary: Retrieve a partner group
      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 group belongs to.
        schema:
          type: integer
      - name: PartnerGroupId
        in: path
        required: true
        description: The unique identifier for the partner group.
        schema:
          type: integer
      responses:
        '200':
          description: A single partner group object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartnerGroup'
    put:
      operationId: updatePartnerGroup
      tags:
      - Partner Groups
      summary: Update a partner group
      description: Update group metadata or modify membership by adding or removing partners.
      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 group belongs to.
        schema:
          type: integer
      - name: PartnerGroupId
        in: path
        required: true
        description: The unique identifier for the partner group to update.
        schema:
          type: integer
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                Name:
                  type: string
                  description: New name for the partner group.
                  example: Acme Top Partners
                MediaPartnersAdd:
                  type: string
                  description: Comma-separated list of partner IDs to add.
                  example: '2552843'
                MediaPartnersRemove:
                  type: string
                  description: Comma-separated list of partner IDs to remove.
                  example: '2552842'
      responses:
        '200':
          description: The partner group was updated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartnerGroupStatusResponse'
    delete:
      operationId: deletePartnerGroup
      tags:
      - Partner Groups
      summary: Delete a partner group
      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 group belongs to.
        schema:
          type: integer
      - name: PartnerGroupId
        in: path
        required: true
        description: The unique identifier for the partner group to delete.
        schema:
          type: integer
      responses:
        '200':
          description: The partner group was deleted successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  Status:
                    type: string
                    description: Indicates that the partner group was deleted.
                    example: DELETED
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
  schemas:
    PartnerGroup:
      type: object
      properties:
        Id:
          type: string
          description: The unique identifier for the partner group.
          example: '99999'
        Name:
          type: string
          description: The partner group's name. Only visible to you and other account members, not visible to partners.
          example: Acme Top Partners
        MediaPartners:
          type: array
          description: The partners belonging to this group.
          items:
            type: object
            properties:
              PartnerId:
                type: string
                description: The unique identifier of the partner.
                example: '2552842'
              PartnerName:
                type: string
                description: The display name of the partner.
                example: Wile E. Coyote Facebook
              PartnerUri:
                type: string
                format: uri-reference
                description: The unique reference to the partner in the impact.com API.
                example: /Advertisers/<AccountSID>/MediaPartners/2552842
        Uri:
          type: string
          format: uri-reference
          description: The unique reference to this partner group in the impact.com API.
          example: /Advertisers/<AccountSID>/Campaigns/1000/MediaPartnerGroups/99999
    PartnerGroupStatusResponse:
      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 partner group.
          example: /Advertisers/<AccountSID>/Campaigns/8882/MediaPartnerGroups/12345
