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

> ## Agent Instructions
> Trackstar is a unified REST API for WMS, cart, and carrier systems. Base URL: https://production.trackstarhq.com. There is no SDK; call the API with plain HTTP.
> Send x-trackstar-api-key on every request. Endpoints scoped to one connection also need x-trackstar-access-token. Read both from environment variables and never print them.
> Reads return data Trackstar has already synced from the connected system. Writes (POST, PUT, PATCH, DELETE) are forwarded to the connected system immediately.
> A new connection has no data until its initial sync finishes. Wait for the connection.historical-sync-completed webhook, or poll GET /connections/{connection_id} and check historical_sync_completed.
> List endpoints page with page_token and next_token (limit is capped at 1000). Repeat every filter on every page. Filters use field[operator]=value, for example created_date[gte]=2026-01-01T00:00:00Z.
> Write bodies must not contain null or empty strings; omit the field instead. Call GET /integrations/{integration_type}/{integration_name}/write-info first to learn the exact fields an integration accepts.
> To test without real credentials, POST /sandbox/generate-sandbox/{wms|cart|carrier} with the API key returns a sandbox access token. Start at https://docs.trackstarhq.com/how-to-guides/build-with-ai.md and install the skills with: npx skills add https://docs.trackstarhq.com

# Create On-Demand Sync

> Request a sync for a specific date range. Creates a sync job that is
processed by a scheduler.

> [!NOTE]
>
> On-demand syncs are only available for select integrations and functions. See [Supported Functions](https://docs.trackstarhq.com/how-to-guides/syncing-data.md#supported-functions) for the current list. Requesting an unsupported integration + function combination returns a `400`. For how on-demand syncs work end to end, see the [On-Demand Syncs guide](https://docs.trackstarhq.com/how-to-guides/syncing-data.md#on-demand-syncs).


## OpenAPI

````yaml post /connections/on-demand-syncs
openapi: 3.1.0
info:
  description: >

    Trackstar is a Unified API that provides standard endpoints for Supply Chain
    Logistics. We currently offer an API for Warehouse Management Systems (WMS).
  title: Trackstar API
  version: 0.1.0
servers:
  - description: Trackstar API
    url: https://production.trackstarhq.com
security: []
tags: []
externalDocs:
  description: Trackstar API Documentation
  url: https://docs.trackstarhq.com
paths:
  /connections/on-demand-syncs:
    post:
      tags:
        - Auth
      summary: Create On-Demand Sync
      description: |-
        Request a sync for a specific date range. Creates a sync job that is
        processed by a scheduler.
      operationId: post_create_on_demand_sync
      parameters:
        - in: header
          name: x-trackstar-api-key
          description: Your organization-level Trackstar API key.
          schema:
            type: string
            example: <x-trackstar-api-key>
          required: true
        - in: header
          name: x-trackstar-access-token
          description: >-
            Your user's access token for a specific integration (ShipHero,
            Extensiv, etc).
          schema:
            type: string
            example: <x-trackstar-access-token>
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DateRangeSyncInputSchema'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OnDemandSyncResponseSchema'
          description: Successful response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestErrorSchema'
              examples:
                not_supported:
                  summary: Integration and function not supported
                  value:
                    error: >-
                      On-demand sync is not enabled for {integration_name}
                      {function_name}
                    origin: trackstar
                open_job_exists:
                  summary: Open sync job already exists
                  value:
                    error: >-
                      An open sync job already exists for get_orders. Please
                      wait for it to complete or cancel it first.
                    origin: trackstar
                invalid_range:
                  summary: Invalid time range
                  value:
                    error: start_time must be before end_time
                    origin: trackstar
          description: >-
            The sync job couldn't be created: `start_time` is not before
            `end_time`, on-demand syncs aren't supported for this integration
            and function, or an open sync job already exists for this function.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
          description: Validation error
components:
  schemas:
    DateRangeSyncInputSchema:
      type: object
      properties:
        start_time:
          type: string
          format: date-time
          description: The start time for the sync range.
          example: '2023-03-15T13:45:30Z'
        end_time:
          type: string
          format: date-time
          description: The end time for the sync range.
          example: '2023-03-15T13:45:30Z'
        function_name:
          type: string
          description: The function to sync.
          example: function_name
      required:
        - end_time
        - function_name
        - start_time
      additionalProperties: false
      title: DateRangeSyncInputSchema
    OnDemandSyncResponseSchema:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/SyncJob'
      required:
        - data
      additionalProperties: false
      title: OnDemandSyncResponseSchema
    BadRequestErrorSchema:
      type: object
      properties:
        error:
          type: string
          description: Why the request was rejected.
          example: start_time must be before end_time
        origin:
          type: string
          description: >-
            The origin of the error. `trackstar` for errors from the Trackstar
            API.
          example: trackstar
      required:
        - error
        - origin
      additionalProperties: false
      title: BadRequestErrorSchema
    ValidationError:
      properties:
        error:
          type: string
        detail:
          type: object
          properties:
            <location>:
              type: object
              properties:
                <field_name>:
                  type: array
                  items:
                    type: string
      required:
        - error
      type: object
      title: ValidationError
    SyncJob:
      type: object
      properties:
        id:
          type: string
          description: The sync job ID.
          example: 550e8400-e29b-41d4-a716-446655440000
        connection_id:
          type: string
          description: The connection ID for the sync job.
          example: 07b344db-0304-4866-9ae1-ac8af5292a28
        function_name:
          type: string
          description: The function being synced.
          example: get_orders
        status:
          type: string
          enum:
            - open
            - cancelled
            - completed
            - stuck
          description: The job status.
          example: open
        requested_start_time:
          type: string
          description: Start of the sync range.
          example: '2024-01-01T00:00:00Z'
        requested_end_time:
          type: string
          description: End of the sync range.
          example: '2024-01-31T23:59:59Z'
        created_at:
          type: string
          description: When the job was created.
          example: '2024-01-15T12:00:00Z'
        completed_at:
          type:
            - string
            - 'null'
          description: When the job completed.
          example: '2024-01-15T12:05:00Z'
        cancelled_at:
          type:
            - string
            - 'null'
          description: When the job was cancelled.
          example: '2024-01-15T12:05:00Z'
      required:
        - connection_id
        - created_at
        - function_name
        - id
        - requested_end_time
        - requested_start_time
        - status
      additionalProperties: false
      title: SyncJob

````

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