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

# Upsert runtime snapshot

> Synchronize account runtime strategy state into Phonefarm.



## OpenAPI

````yaml /openapi.json post /runtime-snapshots/upsert
openapi: 3.1.0
info:
  title: Phonefarm Public API
  description: >-
    Process-first public API for externally triggered Phonefarm execution across
    TikTok and Instagram.
  version: '2026-05-09'
servers:
  - url: https://phonefarm.withmithras.com
security:
  - bearerAuth: []
paths:
  /runtime-snapshots/upsert:
    post:
      tags:
        - Runtime
      summary: Upsert runtime snapshot
      description: Synchronize account runtime strategy state into Phonefarm.
      operationId: upsertRuntimeSnapshot
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RuntimeSnapshotRequest'
      responses:
        '200':
          description: Snapshot upserted or ignored as stale.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RuntimeSnapshotResponse'
        '401':
          description: Missing or invalid bearer token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Requested process, account, or queue item was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: State conflict.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Invalid request payload.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Unexpected runtime, environment, or database failure.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    RuntimeSnapshotRequest:
      type: object
      properties:
        account_id:
          type: string
          minLength: 1
        ugc_account_id:
          type: string
          minLength: 1
        snapshot_id:
          type: string
          minLength: 1
        strategy_version:
          type: integer
          minimum: 1
        content_hash:
          type: string
          minLength: 1
        strategy_synced_at:
          type: string
          format: date-time
        stage:
          type:
            - string
            - 'null'
        active_action:
          type:
            - string
            - 'null'
        active_skills:
          type: array
          items:
            type: string
        personality:
          type: object
          additionalProperties: true
      required:
        - account_id
        - ugc_account_id
        - snapshot_id
        - strategy_version
        - content_hash
        - strategy_synced_at
        - personality
    RuntimeSnapshotResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - upserted
            - ignored_stale
        account_id:
          type: string
        snapshot_id:
          type: string
        strategy_version:
          type: integer
        strategy_synced_at:
          type: string
          format: date-time
      required:
        - status
        - account_id
        - snapshot_id
        - strategy_version
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        details:
          type: object
          additionalProperties: true
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      x-default: PHONEFARM_API_KEY

````