Optimizely Audiences API

Create and manage audience segments for targeting experiments and rollouts.

Documentation

Specifications

Other Resources

OpenAPI Specification

optimizely-audiences-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Optimizely Campaign REST Assets Audiences API
  description: The Optimizely Campaign REST API provides programmatic access to Optimizely's email and omnichannel campaign management capabilities. Developers can use the API to manage campaigns, recipients, mailing lists, smart campaigns, transactional mails, and messaging workflows. The API is hosted at api.campaign.episerver.net and supports automation of marketing campaign operations, enabling integration with external systems and custom marketing workflows. The base URL includes the client ID for multi-tenant access.
  version: '1.0'
  contact:
    name: Optimizely Support
    url: https://support.optimizely.com
  termsOfService: https://www.optimizely.com/legal/terms/
servers:
- url: https://api.campaign.episerver.net/rest
  description: Optimizely Campaign Production Server
security:
- basicAuth: []
tags:
- name: Audiences
  description: Create and manage audience segments for targeting experiments and rollouts.
paths:
  /audiences:
    get:
      operationId: listAudiences
      summary: List audiences
      description: Returns a list of audiences for the specified project.
      tags:
      - Audiences
      parameters:
      - $ref: '#/components/parameters/projectIdQuery'
      - $ref: '#/components/parameters/perPage'
      - $ref: '#/components/parameters/page'
      responses:
        '200':
          description: Successfully retrieved the list of audiences
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Audience'
        '401':
          description: Authentication credentials are missing or invalid
    post:
      operationId: createAudience
      summary: Create an audience
      description: Creates a new audience within the specified project.
      tags:
      - Audiences
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AudienceInput'
      responses:
        '201':
          description: Audience successfully created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Audience'
        '400':
          description: Invalid request body
        '401':
          description: Authentication credentials are missing or invalid
  /audiences/{audience_id}:
    get:
      operationId: getAudience
      summary: Get an audience
      description: Retrieves the full details of a specific audience.
      tags:
      - Audiences
      parameters:
      - $ref: '#/components/parameters/audienceId'
      responses:
        '200':
          description: Successfully retrieved the audience
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Audience'
        '401':
          description: Authentication credentials are missing or invalid
        '404':
          description: Audience not found
    patch:
      operationId: updateAudience
      summary: Update an audience
      description: Updates the specified audience with the provided fields.
      tags:
      - Audiences
      parameters:
      - $ref: '#/components/parameters/audienceId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AudienceInput'
      responses:
        '200':
          description: Audience successfully updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Audience'
        '400':
          description: Invalid request body
        '401':
          description: Authentication credentials are missing or invalid
        '404':
          description: Audience not found
components:
  parameters:
    perPage:
      name: per_page
      in: query
      required: false
      description: Number of results per page
      schema:
        type: integer
        default: 25
        minimum: 1
        maximum: 100
    projectIdQuery:
      name: project_id
      in: query
      required: true
      description: The unique identifier for the project to filter by
      schema:
        type: integer
        format: int64
    page:
      name: page
      in: query
      required: false
      description: Page number for pagination
      schema:
        type: integer
        default: 1
        minimum: 1
    audienceId:
      name: audience_id
      in: path
      required: true
      description: The unique identifier for the audience
      schema:
        type: integer
        format: int64
  schemas:
    AudienceInput:
      type: object
      description: Input for creating or updating an audience
      properties:
        project_id:
          type: integer
          format: int64
          description: The project this audience belongs to
        name:
          type: string
          description: Human-readable name of the audience
        description:
          type: string
          description: Description of the audience
        conditions:
          type: string
          description: JSON-encoded audience conditions
    Audience:
      type: object
      description: An audience segment for targeting
      properties:
        id:
          type: integer
          format: int64
          description: Unique identifier for the audience
        project_id:
          type: integer
          format: int64
          description: The project this audience belongs to
        name:
          type: string
          description: Human-readable name of the audience
        description:
          type: string
          description: Description of the audience criteria
        conditions:
          type: string
          description: JSON-encoded audience conditions
        created:
          type: string
          format: date-time
          description: Timestamp when the audience was created
        last_modified:
          type: string
          format: date-time
          description: Timestamp when the audience was last modified
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: HTTP Basic authentication using the Optimizely Campaign API credentials.
externalDocs:
  description: Optimizely Campaign REST API Documentation
  url: https://docs.developers.optimizely.com/optimizely-campaign/docs/rest-api