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

# Stats-job create

> Start an asynchronous stats job for up to 20 entities over up to 90 days (45 if segmented), one placement, optional segmentation. Returns the job id; poll it with `adside x stats-job get` and download with `adside x stats-job-result fetch`. Read-like (no spend). Costs 1 request; X allows 100 concurrent jobs per account.

CLI: `adside x stats-job create`



## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/workspaces/{workspaceId}/x/stats-job/create
openapi: 3.1.0
info:
  title: Adside API
  version: 1.0.0
  description: >-
    Campaigns, creatives, assets and reporting across your ad accounts. Call it
    with a personal API key as a bearer token, or with the `adside` CLI: each
    page names its command.
servers:
  - url: https://api.adside.ai
    description: Production
security:
  - userAccess: []
tags:
  - name: Account
  - name: Reporting
  - name: Meta
  - name: Google Ads
  - name: LinkedIn
  - name: TikTok
  - name: Reddit
  - name: Snapchat
  - name: X
  - name: Google Tag Manager
  - name: Creatives
  - name: Creative styles
  - name: Media
  - name: Characters
  - name: Assets
  - name: Brands
  - name: Brain
  - name: Research
  - name: Boards
  - name: Artifacts
  - name: Audiences
  - name: Ad comments
  - name: Publications
  - name: Routines
  - name: Skills
  - name: To-dos
  - name: Audit
  - name: Credits
paths:
  /v1/workspaces/{workspaceId}/x/stats-job/create:
    post:
      tags:
        - X
      summary: Stats-job create
      description: >-
        Start an asynchronous stats job for up to 20 entities over up to 90 days
        (45 if segmented), one placement, optional segmentation. Returns the job
        id; poll it with `adside x stats-job get` and download with `adside x
        stats-job-result fetch`. Read-like (no spend). Costs 1 request; X allows
        100 concurrent jobs per account.


        CLI: `adside x stats-job create`
      operationId: x.create_x_stats_job
      parameters:
        - name: workspaceId
          in: path
          required: true
          schema:
            type: string
            minLength: 1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $schema: https://json-schema.org/draft/2020-12/schema
              type: object
              properties:
                account_id:
                  description: >-
                    X ads account id (e.g. 18ce55xcrlv). Omit it: it defaults to
                    the ads account this workspace is connected to, and any
                    other account is refused.
                  type: string
                entity:
                  default: CAMPAIGN
                  type: string
                  enum:
                    - ACCOUNT
                    - FUNDING_INSTRUMENT
                    - CAMPAIGN
                    - LINE_ITEM
                    - PROMOTED_TWEET
                    - PROMOTED_ACCOUNT
                    - MEDIA_CREATIVE
                entity_ids:
                  minItems: 1
                  maxItems: 20
                  type: array
                  items:
                    type: string
                    minLength: 1
                  description: Up to 20 ids of that entity.
                preset:
                  description: >-
                    Shortcut for a date range. Default last_7d when no
                    start_date/end_date given.
                  type: string
                  enum:
                    - today
                    - yesterday
                    - last_7d
                    - last_14d
                    - last_30d
                    - this_month
                    - last_month
                start_date:
                  description: First day, YYYY-MM-DD, in the account's time zone.
                  type: string
                  pattern: ^\d{4}-\d{2}-\d{2}$
                end_date:
                  description: >-
                    Last day (inclusive), YYYY-MM-DD, in the account's time
                    zone. The exclusive end X wants is computed for you.
                  type: string
                  pattern: ^\d{4}-\d{2}-\d{2}$
                granularity:
                  default: DAY
                  description: >-
                    DAY buckets are midnight-to-midnight in the account's time
                    zone; HOUR is hourly; TOTAL is one bucket.
                  type: string
                  enum:
                    - DAY
                    - HOUR
                    - TOTAL
                placement:
                  default: ALL_ON_TWITTER
                  type: string
                  enum:
                    - ALL_ON_TWITTER
                    - PUBLISHER_NETWORK
                    - SPOTLIGHT
                    - TREND
                  description: >-
                    One placement per stats request (X accepts a single value).
                    Default ALL_ON_TWITTER; other placements are separate calls.
                metric_groups:
                  description: >-
                    X metric groups to request. MOBILE_CONVERSION must be
                    requested alone.
                  type: array
                  items:
                    type: string
                    enum:
                      - ENGAGEMENT
                      - BILLING
                      - VIDEO
                      - WEB_CONVERSION
                      - MOBILE_CONVERSION
                      - LIFE_TIME_VALUE_MOBILE_CONVERSION
                segmentation_type:
                  description: >-
                    One segmentation per job (AGE, GENDER, METROS + country,
                    PLATFORMS, CONVERSION_TAGS). Caps the window at 45 days.
                    CAUTION: since April 2026 segmented jobs often return null
                    metrics or 500s on X's side.
                  type: string
                  enum:
                    - AGE
                    - GENDER
                    - METROS
                    - PLATFORMS
                    - CONVERSION_TAGS
                country:
                  description: Required with segmentation_type METROS.
                  type: string
                  minLength: 2
                  maxLength: 2
              required:
                - entity_ids
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $schema: https://json-schema.org/draft/2020-12/schema
      security:
        - userAccess: []
components:
  securitySchemes:
    userAccess:
      type: http
      scheme: bearer
      description: >-
        A personal API key (`adside_pat_…`) or a token from `adside login`.
        Either carries the permissions of the person it belongs to.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.