> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sapt.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create ad set

> Create a new ad set within a campaign (PAUSED by default)



## OpenAPI

````yaml https://api.sapt.ai/openapi.json post /socials/ads/adsets/{projectId}/{accountId}
openapi: 3.1.0
info:
  title: Sapt Platform API
  version: 1.0.0
  description: >-
    API for Sapt platform - project management, authentication, and email
    services
servers:
  - url: https://api.sapt.ai
    description: Production
  - url: http://localhost:8787
    description: Local development
security: []
tags:
  - name: Accounts
    description: >-
      The social accounts connected to a project. Start here — the `id` of an
      account is the `socialAccountId` that every posting, scheduling and
      analytics call takes.
  - name: Actions
  - name: Ads
  - name: Agents
  - name: Analytics
    description: >-
      Account- and post-level organic performance for connected Instagram and
      Facebook accounts.
  - name: Assets
  - name: Auth
  - name: CMS
  - name: CRM
  - name: Calendar
  - name: Comments
    description: >-
      Read, reply to, hide and delete comments on published Instagram and
      Facebook posts.
  - name: Content Calendar
    description: >-
      Create, schedule, update and publish organic posts, and stage the media
      they carry. Publishing a post whose status is `failed` retries it.
  - name: Contracts
  - name: Conversions
    description: >-
      Meta server-side Conversions API (CAPI): discover pixels, connect a pixel
      + CAPI token, and send deduped server-side conversions.
  - name: Dashboard Sidebar
  - name: Emails
  - name: Engagement
    description: >-
      Act as the Page or account on published posts: comment, like, unlike, and
      delete a published post.
  - name: Geo
  - name: Google Ads
  - name: Google Analytics
  - name: Google Business
  - name: Integrations
    description: >-
      Connect third-party providers (Meta, Gmail, Google Business Profile, …).
      List providers, mint OAuth connect links, and poll connection status.
  - name: Invitations
  - name: Memory
  - name: OAuth Clients
  - name: Project Roles
  - name: Project Templates
  - name: Projects
  - name: Schedules
  - name: Service Accounts
  - name: Socials
    description: >-
      Organic social: the connected accounts, the content calendar, media
      staging, publishing, comments and engagement across Instagram, Facebook,
      TikTok, YouTube and Google Business Profile.
  - name: Team
  - name: Users
  - name: Web Analytics
  - name: Workflows
paths:
  /socials/ads/adsets/{projectId}/{accountId}:
    post:
      tags:
        - Ads
      summary: Create ad set
      description: Create a new ad set within a campaign (PAUSED by default)
      operationId: createAdSet
      parameters:
        - schema:
            type: string
            format: uuid
          required: true
          name: projectId
          in: path
        - schema:
            type: string
            format: uuid
          required: true
          name: accountId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                campaignId:
                  type: string
                optimizationGoal:
                  type: string
                  enum:
                    - NONE
                    - APP_INSTALLS
                    - APP_INSTALLS_AND_OFFSITE_CONVERSIONS
                    - AD_RECALL_LIFT
                    - ADVERTISER_SILOED_VALUE
                    - AUTOMATIC_OBJECTIVE
                    - CONVERSATIONS
                    - DERIVED_EVENTS
                    - ENGAGED_USERS
                    - EVENT_RESPONSES
                    - IMPRESSIONS
                    - IN_APP_VALUE
                    - LANDING_PAGE_VIEWS
                    - LEAD_GENERATION
                    - LINK_CLICKS
                    - MEANINGFUL_CALL_ATTEMPT
                    - MESSAGING_APPOINTMENT_CONVERSION
                    - MESSAGING_PURCHASE_CONVERSION
                    - OFFSITE_CONVERSIONS
                    - PAGE_LIKES
                    - POST_ENGAGEMENT
                    - PROFILE_AND_PAGE_ENGAGEMENT
                    - PROFILE_VISIT
                    - QUALITY_CALL
                    - QUALITY_LEAD
                    - REACH
                    - REMINDERS_SET
                    - SUBSCRIBERS
                    - THRUPLAY
                    - TWO_SECOND_CONTINUOUS_VIDEO_VIEWS
                    - VALUE
                    - VISIT_INSTAGRAM_PROFILE
                billingEvent:
                  type: string
                  enum:
                    - APP_INSTALLS
                    - CLICKS
                    - IMPRESSIONS
                    - LINK_CLICKS
                    - NONE
                    - OFFER_CLAIMS
                    - PAGE_LIKES
                    - POST_ENGAGEMENT
                    - THRUPLAY
                    - PURCHASE
                    - LISTING_INTERACTION
                targeting:
                  type: object
                  properties:
                    geoLocations:
                      type: object
                      properties:
                        countries:
                          type: array
                          items:
                            type: string
                        countryGroups:
                          type: array
                          items:
                            type: string
                        regions:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        cities:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                              radius:
                                type: number
                              distanceUnit:
                                type: string
                              regionId:
                                type: string
                              region:
                                type: string
                              country:
                                type: string
                            required:
                              - key
                        zips:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                              country:
                                type: string
                            required:
                              - key
                        geoMarkets:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        customLocations:
                          type: array
                          items:
                            type: object
                            properties:
                              latitude:
                                type: number
                              longitude:
                                type: number
                              radius:
                                type: number
                              distanceUnit:
                                type: string
                              addressString:
                                type: string
                              name:
                                type: string
                              country:
                                type: string
                            required:
                              - latitude
                              - longitude
                        electoralDistricts:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        largeGeoAreas:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        mediumGeoAreas:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        smallGeoAreas:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        metroAreas:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        subcities:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        neighborhoods:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        subneighborhoods:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        places:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                              latitude:
                                type: number
                              longitude:
                                type: number
                              radius:
                                type: number
                              distanceUnit:
                                type: string
                            required:
                              - key
                        locationClusterIds:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        locationTypes:
                          type: array
                          items:
                            type: string
                    excludedGeoLocations:
                      type: object
                      properties:
                        countries:
                          type: array
                          items:
                            type: string
                        countryGroups:
                          type: array
                          items:
                            type: string
                        regions:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        cities:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                              radius:
                                type: number
                              distanceUnit:
                                type: string
                              regionId:
                                type: string
                              region:
                                type: string
                              country:
                                type: string
                            required:
                              - key
                        zips:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                              country:
                                type: string
                            required:
                              - key
                        geoMarkets:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        customLocations:
                          type: array
                          items:
                            type: object
                            properties:
                              latitude:
                                type: number
                              longitude:
                                type: number
                              radius:
                                type: number
                              distanceUnit:
                                type: string
                              addressString:
                                type: string
                              name:
                                type: string
                              country:
                                type: string
                            required:
                              - latitude
                              - longitude
                        electoralDistricts:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        largeGeoAreas:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        mediumGeoAreas:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        smallGeoAreas:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        metroAreas:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        subcities:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        neighborhoods:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        subneighborhoods:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        places:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                              latitude:
                                type: number
                              longitude:
                                type: number
                              radius:
                                type: number
                              distanceUnit:
                                type: string
                            required:
                              - key
                        locationClusterIds:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                              name:
                                type: string
                            required:
                              - key
                        locationTypes:
                          type: array
                          items:
                            type: string
                    ageMin:
                      type: number
                    ageMax:
                      type: number
                    genders:
                      type: array
                      items:
                        type: number
                    interests:
                      type: array
                      items:
                        type: object
                        properties:
                          id:
                            type: string
                          name:
                            type: string
                        required:
                          - id
                    behaviors:
                      type: array
                      items:
                        type: object
                        properties:
                          id:
                            type: string
                          name:
                            type: string
                        required:
                          - id
                    customAudiences:
                      type: array
                      items:
                        type: object
                        properties:
                          id:
                            type: string
                        required:
                          - id
                    excludedCustomAudiences:
                      type: array
                      items:
                        type: object
                        properties:
                          id:
                            type: string
                        required:
                          - id
                    placements:
                      type: object
                      properties:
                        devicePlatforms:
                          type: array
                          items:
                            type: string
                            enum:
                              - mobile
                              - desktop
                        publisherPlatforms:
                          type: array
                          items:
                            type: string
                            enum:
                              - facebook
                              - instagram
                              - messenger
                              - audience_network
                        facebookPositions:
                          type: array
                          items:
                            type: string
                        instagramPositions:
                          type: array
                          items:
                            type: string
                        messengerPositions:
                          type: array
                          items:
                            type: string
                        audienceNetworkPositions:
                          type: array
                          items:
                            type: string
                    workEducation:
                      type: object
                      properties:
                        employers:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              name:
                                type: string
                            required:
                              - id
                              - name
                        workPositions:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              name:
                                type: string
                            required:
                              - id
                              - name
                        educationSchools:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              name:
                                type: string
                            required:
                              - id
                              - name
                        educationMajors:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              name:
                                type: string
                            required:
                              - id
                              - name
                    detailedDemographics:
                      type: object
                      properties:
                        relationshipStatuses:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              name:
                                type: string
                            required:
                              - id
                              - name
                        familyStatuses:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              name:
                                type: string
                            required:
                              - id
                              - name
                        lifeEvents:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              name:
                                type: string
                            required:
                              - id
                              - name
                        income:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              name:
                                type: string
                            required:
                              - id
                              - name
                    exclusions:
                      type: object
                      additionalProperties: {}
                    rawTargeting:
                      type: object
                      additionalProperties: {}
                startTime:
                  type: string
                endTime:
                  type: string
                name:
                  type: string
                  minLength: 1
                  maxLength: 400
                status:
                  type: string
                  enum:
                    - ACTIVE
                    - PAUSED
                  default: PAUSED
                dailyBudget:
                  type: integer
                  exclusiveMinimum: 0
                lifetimeBudget:
                  type: integer
                  exclusiveMinimum: 0
                bidAmount:
                  type: integer
                  exclusiveMinimum: 0
              required:
                - campaignId
                - optimizationGoal
                - billingEvent
                - targeting
                - name
      responses:
        '200':
          description: Ad set created
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      adSet:
                        type: object
                        properties:
                          id:
                            type: string
                          name:
                            type: string
                          status:
                            type: string
                        required:
                          - id
                          - name
                          - status
                    required:
                      - adSet
                required:
                  - success
                  - data
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  code:
                    type: string
                    description: Error code for programmatic handling
                required:
                  - message
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  code:
                    type: string
                    description: Error code for programmatic handling
                required:
                  - message
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  code:
                    type: string
                    description: Error code for programmatic handling
                required:
                  - message
        '404':
          description: Not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  code:
                    type: string
                    description: Error code for programmatic handling
                required:
                  - message
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  code:
                    type: string
                    description: Error code for programmatic handling
                required:
                  - message
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT token obtained from /api/auth/token endpoint. Token is verified
        using JWKS and must include a valid user identifier.

````