{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tellers-ai/json-schema/tellers-ai-api-user-schema.json",
  "title": "ApiUser",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tellers-ai-openapi.json#/components/schemas/ApiUser",
  "properties": {
    "firebase_uid": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Firebase Uid"
    },
    "email": {
      "type": "string",
      "title": "Email"
    },
    "company": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Company"
    },
    "first_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "First Name"
    },
    "job_title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Job Title"
    },
    "last_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Name"
    },
    "profile_pic": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Profile Pic"
    },
    "created_at_str": {
      "type": "string",
      "title": "Created At Str",
      "description": "``created_at`` as UTC ISO-8601 ending in Z (e.g. for debugging / clients)."
    },
    "last_seen_at_str": {
      "type": "string",
      "title": "Last Seen At Str",
      "description": "``last_seen_at`` as UTC ISO-8601 ending in Z."
    },
    "updated_at_str": {
      "type": "string",
      "title": "Updated At Str",
      "description": "``updated_at`` as UTC ISO-8601 ending in Z."
    },
    "credits": {
      "type": "number",
      "title": "Credits",
      "description": "Spendable balance from grants (`get_token`), not legacy columns."
    },
    "storage_quota_gb": {
      "type": "integer",
      "title": "Storage Quota Gb",
      "description": "Total storage quota available to the user in GB."
    },
    "storage_used_gb": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Storage Used Gb",
      "description": "Gigabytes this user's assets and their renditions occupy, counting each stored object once and rounded to two decimals. The same unit as ``storage_quota_gb``, so the pair reads directly as \"3.4 of 5 GB\". Null when no total has been computed for the account yet. Read from a cache refreshed hourly, so it can lag a worker that has just written a proxy."
    },
    "subscription": {
      "anyOf": [
        {
          "$ref": "#/$defs/ApiUserSubscription"
        },
        {
          "type": "null"
        }
      ]
    },
    "role": {
      "additionalProperties": {
        "type": "boolean"
      },
      "type": "object",
      "title": "Role",
      "description": "Role flags for roles held by the user. Missing roles are omitted."
    },
    "user_preferences": {
      "$ref": "#/$defs/UserPreferences",
      "description": "Persisted user preferences returned with the user profile."
    }
  },
  "type": "object",
  "required": [
    "firebase_uid",
    "email",
    "company",
    "first_name",
    "job_title",
    "last_name",
    "profile_pic",
    "created_at_str",
    "last_seen_at_str",
    "updated_at_str",
    "credits",
    "storage_quota_gb",
    "subscription",
    "user_preferences"
  ],
  "$defs": {
    "ApiUserSubscription": {
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "Monthly",
            "Yearly",
            "Enterprise"
          ],
          "title": "Type",
          "description": "User-facing subscription cadence label. Enterprise is a plan set up by the Tellers team, billed outside the app: it unlocks every feature and cannot be changed or cancelled from the app."
        },
        "tier": {
          "$ref": "#/$defs/SubscriptionTier",
          "description": "Subscription tier. Subscriptions that predate tiers are reported as basic."
        },
        "pricing_tier": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Pricing Tier",
          "description": "Billing catalog plan `tier_id` the subscription is on (for example `monthly` or `pro_yearly`), including existing subscribers on retired prices; null when it matches no catalog plan."
        },
        "can_configure_tokens": {
          "type": "boolean",
          "title": "Can Configure Tokens",
          "description": "True when the user can buy extra tokens on top of the plan (expert only)."
        },
        "monthly_tokens": {
          "type": "number",
          "title": "Monthly Tokens",
          "description": "Subscription token amount available each month."
        },
        "storage_quota_gb": {
          "type": "integer",
          "title": "Storage Quota Gb",
          "description": "Total storage quota available to the user in GB."
        },
        "pricing": {
          "items": {
            "$ref": "#/$defs/ApiUserSubscriptionPricingLine"
          },
          "type": "array",
          "title": "Pricing",
          "description": "Current Stripe subscription price lines with price id and quantity."
        },
        "currency": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Currency",
          "description": "Lowercase ISO 4217 code the subscription is billed in. Stripe can't change it, so plan changes are priced in it. Null for a subscription not synced since this was added."
        },
        "cancel_at_period_end": {
          "type": "boolean",
          "title": "Cancel At Period End",
          "description": "True when Stripe will cancel the subscription at period end.",
          "default": false
        },
        "cancel_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cancel At",
          "description": "UTC ISO-8601 time when Stripe will cancel the subscription."
        },
        "current_period_end": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Current Period End",
          "description": "UTC ISO-8601 end of the current subscription period."
        },
        "tokens_renew_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Tokens Renew At",
          "description": "UTC ISO-8601 time the plan's monthly tokens are next granted: the renewal for a monthly plan, the next monthly drop for a yearly one. Null when no further grant is due (e.g. the subscription is set to cancel first)."
        },
        "latest_payment_issue": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Latest Payment Issue",
          "description": "When set, an invoice needs payment or customer action (e.g. 3DS). Fields may include invoice_id, invoice_status, hosted_invoice_url, customer_action_url."
        }
      },
      "type": "object",
      "required": [
        "type",
        "tier",
        "can_configure_tokens",
        "monthly_tokens",
        "storage_quota_gb"
      ],
      "title": "ApiUserSubscription"
    },
    "ApiUserSubscriptionPricingLine": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id",
          "description": "Stripe price id for this subscription line."
        },
        "quantity": {
          "type": "integer",
          "title": "Quantity",
          "description": "Quantity for this Stripe price line."
        }
      },
      "type": "object",
      "required": [
        "id",
        "quantity"
      ],
      "title": "ApiUserSubscriptionPricingLine"
    },
    "AssetAnalysisSettings": {
      "properties": {
        "reasoning": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "low",
                "medium",
                "high"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Reasoning"
        },
        "fps": {
          "anyOf": [
            {
              "type": "number",
              "maximum": 24.0,
              "minimum": 1.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Fps"
        },
        "entity_quality": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "low",
                "medium",
                "high"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Entity Quality"
        },
        "asset_quality": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "low",
                "medium",
                "high"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Asset Quality"
        },
        "prompt": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Prompt"
        },
        "long_video": {
          "anyOf": [
            {
              "$ref": "#/$defs/LongVideoAnalysisSettings"
            },
            {
              "type": "null"
            }
          ],
          "description": "Overrides for describing long videos. The fields above apply to short videos, and to long ones when this is disabled."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "AssetAnalysisSettings"
    },
    "LongVideoAnalysisSettings": {
      "properties": {
        "enabled": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Enabled",
          "description": "Whether videos longer than 'min_duration_s' use these settings. When false, every video is described like a short one (static frame sampling, 5-minute chunks)."
        },
        "min_duration_s": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 60.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Min Duration S",
          "description": "Videos longer than this many seconds count as long."
        },
        "processing": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "static",
                "agentic"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Processing",
          "description": "'agentic' lets Gemini pick which frames to look at (cheaper on long footage); 'static' samples at the configured fps."
        },
        "split_duration_s": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Split Duration S",
          "description": "Length in seconds of each Gemini call a long video is split into. 0 sends the whole video in one call."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "LongVideoAnalysisSettings",
      "description": "How descriptions of long videos differ from short ones.\n\nOnly scene-description generation reads this; ``video_analyse_gemini``\ntakes its processing mode as a tool argument instead. Every field is\noptional so a folder config can override one of them and inherit the rest."
    },
    "SubscriptionTier": {
      "type": "string",
      "enum": [
        "basic",
        "pro",
        "expert",
        "enterprise_user"
      ],
      "title": "SubscriptionTier",
      "description": "Named subscription offer; subscriptions that predate tiers read as basic.\n\n``enterprise_user`` is granted by hand outside Stripe (see\n:mod:`tellers_common.enterprise_user_subscription`) and ranks above every paid tier."
    },
    "UserPreferences": {
      "properties": {
        "analysis": {
          "anyOf": [
            {
              "$ref": "#/$defs/AssetAnalysisSettings"
            },
            {
              "type": "null"
            }
          ]
        },
        "upload": {
          "anyOf": [
            {
              "$ref": "#/$defs/UserUploadPreferences"
            },
            {
              "type": "null"
            }
          ],
          "description": "Upload defaults: whether each uploaded file is transcribed and described automatically."
        }
      },
      "additionalProperties": true,
      "type": "object",
      "title": "UserPreferences"
    },
    "UserUploadPreferences": {
      "properties": {
        "generate_stt_from_op_atom": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Generate Stt From Op Atom",
          "description": "Transcribe uploaded Avid OP-Atom MXF files. Applies when a file is uploaded. Unset falls back to the app default; a tellers-config file in the asset's folder tree that sets this field takes precedence."
        },
        "generate_stt_from_master_clip": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Generate Stt From Master Clip",
          "description": "Transcribe uploaded media and master clips. Applies when a file is uploaded. Unset falls back to the app default; a tellers-config file in the asset's folder tree that sets this field takes precedence."
        },
        "generate_stt_with_diarization": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Generate Stt With Diarization",
          "description": "Split upload transcripts by speaker. Applies when a file is uploaded. Unset falls back to the app default; a tellers-config file in the asset's folder tree that sets this field takes precedence."
        },
        "generate_description_from_op_atom": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Generate Description From Op Atom",
          "description": "Generate a description for uploaded Avid OP-Atom MXF files. Applies when a file is uploaded. Unset falls back to the app default; a tellers-config file in the asset's folder tree that sets this field takes precedence."
        },
        "generate_description_from_master_clip": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Generate Description From Master Clip",
          "description": "Generate a description for uploaded media and master clips. Applies when a file is uploaded. Unset falls back to the app default; a tellers-config file in the asset's folder tree that sets this field takes precedence."
        },
        "delete_after_hours": {
          "anyOf": [
            {
              "type": "integer",
              "maximum": 8760.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Delete After Hours",
          "description": "Make every new file transient: a file the user uploads or generates is deleted this many hours after it is created. 0 or unset keeps files. A tellers-config file in the asset's folder tree that sets this field takes precedence."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "UserUploadPreferences",
      "description": "What runs automatically on every file the user uploads.\n\nSame fields, same meaning as on ``TellersConfigFile``. Resolution order is\nthe folder's tellers-config, then these, then the app default."
    }
  }
}