Microsoft LinkedIn AdAccounts API

Manage ad accounts

OpenAPI Specification

microsoft-linkedin-adaccounts-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: LinkedIn Marketing AdAccounts API
  description: 'REST API for managing LinkedIn advertising - ad accounts, ad account

    users, ad campaign groups, ad campaigns, and ad creatives. The

    versioned API requires the Linkedin-Version header (YYYYMM format)

    and the X-Restli-Protocol-Version: 2.0.0 header for most endpoints.

    Authentication uses an OAuth 2.0 bearer token with scopes such as

    rw_ads (read/write) or r_ads (read-only).

    '
  version: '202605'
  contact:
    name: Kin Lane
    email: kin@apievangelist.com
  license:
    name: LinkedIn API Terms of Use
    url: https://www.linkedin.com/legal/l/api-terms-of-use
servers:
- url: https://api.linkedin.com
  description: LinkedIn API production
security:
- oauth2:
  - rw_ads
tags:
- name: AdAccounts
  description: Manage ad accounts
paths:
  /rest/adAccounts:
    get:
      tags:
      - AdAccounts
      summary: Search ad accounts
      operationId: adAccounts_search
      parameters:
      - name: q
        in: query
        required: true
        schema:
          type: string
          enum:
          - search
      - name: search
        in: query
        schema:
          type: string
          description: Search criteria, e.g. (type:(values:List(BUSINESS)),status:(values:List(ACTIVE)))
      - name: pageSize
        in: query
        schema:
          type: integer
          maximum: 1000
      - name: pageToken
        in: query
        schema:
          type: string
      - $ref: '#/components/parameters/linkedinVersion'
      - $ref: '#/components/parameters/restliProtocol'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdAccountSearchResponse'
    post:
      tags:
      - AdAccounts
      summary: Create an ad account (or batch create with X-RestLi-Method header)
      operationId: adAccounts_create
      parameters:
      - $ref: '#/components/parameters/linkedinVersion'
      - $ref: '#/components/parameters/restliProtocol'
      - name: X-RestLi-Method
        in: header
        schema:
          type: string
          enum:
          - BATCH_CREATE
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
              - $ref: '#/components/schemas/AdAccount'
              - type: object
                properties:
                  elements:
                    type: array
                    items:
                      $ref: '#/components/schemas/AdAccount'
      responses:
        '201':
          description: Created (account ID returned in x-restli-id header)
  /rest/adAccounts/{adAccountID}:
    get:
      tags:
      - AdAccounts
      summary: Fetch an ad account
      operationId: adAccounts_get
      parameters:
      - $ref: '#/components/parameters/adAccountID'
      - $ref: '#/components/parameters/linkedinVersion'
      - $ref: '#/components/parameters/restliProtocol'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdAccount'
    post:
      tags:
      - AdAccounts
      summary: Update an ad account (partial update via patch payload)
      operationId: adAccounts_update
      parameters:
      - $ref: '#/components/parameters/adAccountID'
      - $ref: '#/components/parameters/linkedinVersion'
      - $ref: '#/components/parameters/restliProtocol'
      - name: X-RestLi-Method
        in: header
        schema:
          type: string
          enum:
          - PARTIAL_UPDATE
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                patch:
                  type: object
                  properties:
                    $set:
                      type: object
                      additionalProperties: true
      responses:
        '204':
          description: No Content
    delete:
      tags:
      - AdAccounts
      summary: Delete a DRAFT ad account
      operationId: adAccounts_delete
      parameters:
      - $ref: '#/components/parameters/adAccountID'
      - $ref: '#/components/parameters/linkedinVersion'
      - $ref: '#/components/parameters/restliProtocol'
      responses:
        '204':
          description: No Content
components:
  parameters:
    adAccountID:
      name: adAccountID
      in: path
      required: true
      schema:
        type: string
    linkedinVersion:
      name: Linkedin-Version
      in: header
      required: true
      description: LinkedIn API version in YYYYMM format
      schema:
        type: string
        example: '202605'
    restliProtocol:
      name: X-Restli-Protocol-Version
      in: header
      required: true
      schema:
        type: string
        enum:
        - 2.0.0
  schemas:
    AdAccount:
      type: object
      required:
      - name
      - type
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        type:
          type: string
          enum:
          - BUSINESS
          - ENTERPRISE
        currency:
          type: string
          default: USD
        reference:
          type: string
          description: URN such as urn:li:organization:{id} or urn:li:person:{id}
        status:
          type: string
          enum:
          - ACTIVE
          - DRAFT
          - CANCELED
          - PENDING_DELETION
          - REMOVED
          default: ACTIVE
        notifiedOnCampaignOptimization:
          type: boolean
        notifiedOnCreativeApproval:
          type: boolean
        notifiedOnCreativeRejection:
          type: boolean
        notifiedOnEndOfCampaign:
          type: boolean
        notifiedOnNewFeaturesEnabled:
          type: boolean
        servingStatuses:
          type: array
          items:
            type: string
            enum:
            - RUNNABLE
            - STOPPED
            - BILLING_HOLD
            - ACCOUNT_TOTAL_BUDGET_HOLD
            - ACCOUNT_END_DATE_HOLD
            - RESTRICTED_HOLD
            - INTERNAL_HOLD
        test:
          type: boolean
          default: false
    AdAccountSearchResponse:
      type: object
      properties:
        elements:
          type: array
          items:
            $ref: '#/components/schemas/AdAccount'
        metadata:
          type: object
          properties:
            nextPageToken:
              type: string
  securitySchemes:
    oauth2:
      type: oauth2
      description: LinkedIn OAuth 2.0 (3-legged or 2-legged)
      flows:
        authorizationCode:
          authorizationUrl: https://www.linkedin.com/oauth/v2/authorization
          tokenUrl: https://www.linkedin.com/oauth/v2/accessToken
          scopes:
            rw_ads: Read and write LinkedIn ads data
            r_ads: Read LinkedIn ads data
            r_ads_reporting: Read LinkedIn ads reporting
            r_organization_social: Read organization social actions
            w_organization_social: Write organization social actions