openapi: 3.0.2
info:
  title: Audience API
  version: '4.0'
  x-logo: 
    url: https://dataservices-docs.segmint.net/images/segmint-logo.png
  description: 'The Audience API consists of endpoints to interact with various audiences. Audiences are build via KLI® equations.'
servers:
  - url: https://api.segmint.net/v4/audience
    description: 'The production environment'
  - url: https://api-stage.segmint.net/v4/audience
    description: 'The staging environment'
tags:
  - name: Saved Equations
    description: Saving KLI® equations to build audiences.
security:
  - Bearer: []
components:
  responses:
      unexpected_error: 
        description: "An unexpected error occurred. Please try again later. If the problem persists please contact us."
      unauthorized:
        description: "The request was not authorized. The bearer token may have been missing or expired."
      forbidden: 
        description: "You do not have permission to use this endpoint."
  securitySchemes:
      Bearer: 
        type: http
        scheme: bearer
        description: "Standard bearer authentication. To get a token please see [Authentication](/marketing/api/security)."
  parameters:
      partner_id:
        name: partner_id,
        in: "path"
        required: true
        description: The id of the partner you are interacting with
        schema: 
          type: string
        
paths:
  "/partners/{partner_id}/audiences":
    get:
      summary: "Get a list of saved equations."
      description: |-
        List the saved equations for the partner. This includes all saved equations regardless of who created them.
        ### <span style="color:var(--red)">Fields marked with an * are required. </span>
      tags:
        - "Saved Equations"
      parameters:
        - $ref: "#/components/parameters/partner_id"
      responses:
        200:
          description: "Retrieved a list of audiences"
          content:
            "application/json":
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      description: The Audience Id
                    partner_id:
                      type: string
                    name:
                      type: string
                      description: "The name the Audience was saved as"
                    archived:
                      type: boolean
                      description: "If the audience was archived."
                    shared:
                      type: boolean
                      description: "Was the audience shared with the other user of this partner"
                    created:
                      type: string
                      format: date-time
        400:
          description: "Failed to queue generation of the export. It may already be in queue."
        401: 
          $ref: "#/components/responses/unauthorized"
        403:
          $ref: "#/components/responses/forbidden"
        404:
          "description": "Resource not found. Likely the url is incorrect."
