FirstPromoter Assets API

FirstPromoter Assets API - 6 operation(s) on the admin (api/v2/company) surface, from FirstPromoter's own published OpenAPI definition (3.0.1) indexed in https://docs.firstpromoter.com/llms.txt.

OpenAPI Specification

firstpromoter-v2-assets-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: FirstPromoter Assets API
  version: '1.0'
  description: API for managing marketing assets in FirstPromoter
servers:
- url: https://api.firstpromoter.com/api/v2/company
security:
- BearerAuth: []
paths:
  /assets:
    get:
      summary: Get available assets
      description: "Get all available assets \n <Tip>**HTTP Request** <br/>`GET https://api.firstpromoter.com/api/v2/company/assets`</Tip>"
      tags:
      - Assets
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - name: q
        in: query
        description: Search params. Search by name or url
        required: false
        schema:
          type: string
      - name: filters[asset_type]
        in: query
        description: Asset type
        required: false
        schema:
          type: string
          enum:
          - image
          - document
          - link
          - text
      - name: filters[category_id]
        in: query
        description: 'Category ids. Can be Integer or Array of Integers. If params are "not_set" will retrieve the assets
          that have category_id: null.'
        required: false
        schema:
          oneOf:
          - type: integer
          - type: array
            items:
              type: integer
          - type: string
            enum:
            - not_set
      - name: filters[campaign_id]
        in: query
        description: Campaign ids. Can be Integer or Array of Integers
        required: false
        schema:
          oneOf:
          - type: integer
          - type: array
            items:
              type: integer
      - name: filters[created_at][from]
        in: query
        description: created_at start date
        required: false
        schema:
          type: string
          format: date
      - name: filters[created_at][to]
        in: query
        description: created_at end date
        required: false
        schema:
          type: string
          format: date
      responses:
        '200':
          description: List of assets
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Asset'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    post:
      summary: Create assets
      description: "Create assets \n <Tip>**HTTP Request** <br/>`POST https://api.firstpromoter.com/api/v2/company/assets`</Tip>"
      tags:
      - Assets
      parameters:
      - $ref: '#/components/parameters/AccountId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - name
              - asset_type
              properties:
                name:
                  type: string
                  description: Name of the asset
                asset_type:
                  type: string
                  enum:
                  - image
                  - document
                  - link
                  - text
                  description: Type of the asset
                file:
                  type: string
                  format: binary
                  description: File of the asset if asset_type is image or document
                url:
                  type: string
                  description: URL of the asset
                category_id:
                  type: integer
                  description: ID of the category
                allowed_campaign_ids:
                  type: array
                  items:
                    type: integer
                  description: Array of allowed campaign IDs
                content:
                  type: string
                  description: Content. Required for email and social media asset types
                landing_page_url:
                  type: string
                  description: Landing page url. Optional for social media asset types
      responses:
        '200':
          description: Asset created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Asset'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /assets/{id}:
    get:
      summary: Get asset
      description: "Get asset details \n <Tip>**HTTP Request** <br/>`GET https://api.firstpromoter.com/api/v2/company/assets/{id}`</Tip>"
      tags:
      - Assets
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - name: id
        in: path
        required: true
        description: ID of the asset
        schema:
          type: integer
      responses:
        '200':
          description: Asset details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Asset'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      summary: Update asset
      tags:
      - Assets
      description: " Update an asset \n <Tip>**HTTP Request** <br/>`PUT https://api.firstpromoter.com/api/v2/company/assets/{id}`</Tip>"
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - name: id
        in: path
        required: true
        description: ID of the asset to be updated
        schema:
          type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Name of the asset
                asset_type:
                  type: string
                  enum:
                  - image
                  - document
                  - link
                  - text
                  description: Type of the asset
                file:
                  type: string
                  format: binary
                  description: File of the asset if asset_type is image or document
                url:
                  type: string
                  description: URL of the asset
                category_id:
                  type: integer
                  description: ID of the category
                allowed_campaign_ids:
                  type: array
                  items:
                    type: integer
                  description: Array of allowed campaign IDs
                content:
                  type: string
                  description: Content. Required for email and social media asset types
                landing_page_url:
                  type: string
                  description: Landing page url. Optional for social media asset types
      responses:
        '200':
          description: Asset updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Asset'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /assets/update_category:
    put:
      summary: Update category of an asset
      description: "Update category of an asset \n <Tip>**HTTP Request** <br/>`PUT https://api.firstpromoter.com/api/v2/company/assets/update_category`</Tip>"
      tags:
      - Assets
      parameters:
      - $ref: '#/components/parameters/AccountId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - category_id
              properties:
                ids:
                  type: array
                  items:
                    type: integer
                  description: Array of asset ids
                category_id:
                  type: integer
                  description: ID of the category. If null, category will be removed
      responses:
        '200':
          description: Operation completed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchOperationResult'
        '202':
          description: Operation accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchOperationResult'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /assets/destroy:
    delete:
      summary: Delete assets
      description: "Delete assets \n <Tip>**HTTP Request** <br/>`DELETE https://api.firstpromoter.com/api/v2/company/assets/destroy`</Tip>"
      tags:
      - Assets
      parameters:
      - $ref: '#/components/parameters/AccountId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                ids:
                  type: array
                  items:
                    type: integer
                  description: Selected ids of assets to delete
      responses:
        '200':
          description: Operation completed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchOperationResult'
        '202':
          description: Operation accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchOperationResult'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    AccountId:
      name: Account-ID
      in: header
      required: true
      description: Account identifier that specifies which account is making the request
      schema:
        type: string
        example: acc_123456
  schemas:
    Asset:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        allowed_campaign_ids:
          type: array
          items:
            type: integer
        details:
          type: object
          properties:
            file_format:
              type: string
            file_size:
              type: integer
            image_size:
              type: object
              properties:
                width:
                  type: integer
                height:
                  type: integer
        content:
          type: string
        landing_page_url:
          type: string
        asset_type:
          type: string
          enum:
          - image
          - document
          - link
          - text
        url:
          type: string
        thumbnail_url:
          type: string
        uploading:
          type: boolean
        category:
          type: object
          properties:
            id:
              type: integer
            name:
              type: string
            position:
              type: integer
        allowed_campaigns:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
              name:
                type: string
              color:
                type: string
    Error:
      type: object
      properties:
        message:
          type: string
        code:
          type: string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
    BatchOperationResult:
      type: object
      properties:
        id:
          type: integer
        status:
          type: string
          enum:
          - pending
          - completed
        total:
          type: integer
        selected_total:
          type: integer
        processed_count:
          type: integer
        failed_count:
          type: integer
        action_label:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        meta:
          type: object
        progress:
          type: integer
        processing_errors:
          type: array
          items:
            type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Access token passed as a Bearer token in the Authorization header
    accountId:
      type: apiKey
      in: header
      name: ACCOUNT-ID
      description: Account ID required with bearer token