---
title: "Api Accounts Create"
method: POST
path: "/api/accounts/"
tags: ["users"]
---

# Api Accounts Create

`POST /api/accounts/`

POST handler with superadmin-only field protection.

Strips superadmin-only fields from non-superadmin requests before
delegating to OrganizationInjectionMixin.post() for org injection.

## Headers

- `Authorization` string, required

## Request body

- PlatformAccountCreateRequest — For create operations - creates account with optional organization. Used by POST /api/accounts/ Creates: 1. APIUser with email/password 2. Optionally creates Organization with specified name (default: creates org) 3. Links user to organization via OrganizationUserRole (if org created)
  - `email` string, required
  - `password` string, required
  - `name` string
  - `username` string
  - `first_name` string
  - `last_name` string
  - `is_active` boolean
  - `organization_name` string, nullable
  - `create_organization` boolean

## Response `201`

- PlatformAccountCreate — For create operations - creates account with optional organization. Used by POST /api/accounts/ Creates: 1. APIUser with email/password 2. Optionally creates Organization with specified name (default: creates org) 3. Links user to organization via OrganizationUserRole (if org created)
  - `id` integer, required
  - `email` string, required
  - `name` string
  - `username` string
  - `first_name` string
  - `last_name` string
  - `is_active` boolean
  - `created_at` string, date-time, required
  - `organization` Organization, required — DEV-10098: the "Customize retention policy" toggle IS the override's presence. ``Organization.is_custom_retention_enabled`` was never read by ``enforce_data_retention`` — the cron only ever min()s ``logs_retention_period_in_days`` with the plan window — so switching the toggle off left the stale override silently hard-deleting on the old (shorter) window while the page claimed the plan default. The column is retired; the wire field of the same name keeps its shape but is now DERIVED from the override, so what the page renders is what the cron enforces.
    - `id` integer, required
    - `active_subscription` boolean, required
    - `onboarding_method` union, required
      - 'gateway' | 'tracing' — * `gateway` - Gateway * `tracing` - Tracing
      - unknown
    - `disabled_span_behaviors` string[] — Behavior slugs excluded from span-behavior evaluation.
    - `company_organization` CompanyOrganizationList, required
      - `id` integer, required
      - `plan_level` integer, required
      - `unique_company_organization_id` string
      - `company_organization_unique_id` string, nullable
      - `name` string, required
      - `email_domain` string, nullable
      - `created_at` string, date-time, required
      - `updated_at` string, date-time, required
      - `plan` 'none' | 'starter' | 'team' | 'custom' | 'seat_based_free' | 'seat_based_pro' | 'seat_based_team' | 'seat_based_enterprise' | 'seat_based_custom' | 'respan_team' | 'respan_pro' — * `none` - Default * `starter` - Starter * `team` - Team * `custom` - Custom * `seat_based_free` - Seat Based Free * `seat_based_pro` - Seat Based Pro * `seat_based_team` - Seat Based Team * `seat_based_enterprise` - Seat Based Enterprise * `seat_based_custom` - Seat Based Custom * `respan_team` - Respan Team * `respan_pro` - Respan Pro
      - `stripe_customer_id` string
      - `llm_gateway_markup_rate` number, double — LLM gateway markup rate (default 0% markup). Single source of truth: DEFAULT_LLM_GATEWAY_MARKUP_RATE.
      - `credit_low_balance_threshold` number, double, nullable
      - `credit_auto_top_off_threshold` number, double, nullable
      - `credit_auto_top_off_amount` number, double, nullable
      - `is_auto_top_off_enabled` boolean
    - `organization_subscription` OrganizationSubscription, required
      - `id` integer, required
      - `plan_level` integer, required
      - `api_key_limit` integer, required
      - `log_limit` integer, required
      - `current_customer_id` string, required
      - `dataset_size_limit` integer, required
      - `credits` Credit[], required
        - `id` integer, required
        - `expired` boolean, required
        - `amount` number, double
        - `currency` string
        - `description` string
        - `created_at` string, date-time, required
        - `expire_at` string, date-time, nullable
        - `recurring` boolean
        - `hidden_threshold` number, double
        - `organization_subscription` integer, nullable
      - `project` string, nullable
      - `active_billing` boolean, required
      - `seats_cost_for_full_period` number, double, required
      - `prompts_cost` number, double, required
      - `free_trial_days_left` integer, required
      - `current_period_start_dt` string, date-time, required
      - `current_period_end_dt` string, date-time, required
      - `is_on_free_trial` boolean, required
      - `plan` string, required
      - `mrr` number, double, required
      - `invoice_this_period` number, double, required
      - `invoice_last_period` number, double, required
      - `free_log_limit` integer, required
      - `logs_cost_this_period` number, double, required
      - `logs_cost_last_period` number, double, required
      - `member_limit` integer, required
      - `member_count` integer, required
      - `monthly_seats_cost` number, double, required
      - `logs_in_period` integer, required
      - `credit_balance` number, double, required
      - `prompt_limit` integer, nullable, required
      - `evaluator_limit` integer, nullable, required
      - `dataset_count_limit` integer, nullable, required
      - `score_limit` integer, nullable, required
      - `plan_retention_period_in_days` integer, nullable, required
      - `subscription_unique_id` string, nullable
      - `created_at` string, date-time, nullable, required
      - `subscribed_at` string, date-time, nullable
      - `free_trial_end_at` string, date-time, nullable
      - `log_visibility_cutoff_at` string, date-time, nullable, required
      - `deal_id` string
      - `monthly_recurring_revenue` number, double
      - `expected_annual_contract_value` number, double
      - `customer_ids` string[]
      - `metered_item_id` string, nullable
      - `seat_based_item_id` string, nullable
      - `base_item_id` string, nullable
      - `stripe_customer_id` string
      - `usage_report_subscription_id` string
      - `subscription_id` string
      - `current_period_start` number, double
      - `current_period_end` number, double
      - `current_usage_period_start` number, double
      - `current_usage_period_end` number, double
      - `usage_in_period` number, double
      - `keywordsai_llm_credentials_usage_in_period` number, double
      - `keywordsai_llm_credentials_usage_last_period` number, double
      - `logs_in_last_period` integer
      - `logs_three_months_ago` integer
      - `customer_user_count` integer
      - `prompt_count` integer
      - `evals_in_period` integer
      - `evals_in_last_period` integer
      - `past_billing_periods` unknown[]
        - unknown
      - `last_usage_reported` number, double
      - `last_reconciled_at` number, double, nullable
      - `billing_method` 'stripe' | 'invoice' | 'other' — * `stripe` - Stripe * `invoice` - Invoice * `other` - Other
      - `billing_period` 'monthly' | 'yearly' — * `monthly` - Monthly * `yearly` - Yearly
      - `usage_report_interval` 'monthly' | 'yearly' — * `monthly` - Monthly * `yearly` - Yearly
      - `current_period_invoice_amount` number, double
      - `last_period_invoice_amount` number, double
      - `budget` number, double, nullable
      - `custom_log_limit` integer, nullable
      - `custom_plan_name` string
      - `custom_monthly_cost` number, double, nullable
      - `custom_yearly_cost` number, double, nullable
      - `deprecated_subscription_ids` unknown
      - `subscription_bool` boolean
      - `custom_subscription` unknown
      - `custom_bundle` unknown
      - `accumulative_balance` number, double
      - `periodic_invoice_amount` number, double
      - `org` integer, nullable
      - `company_organization` integer, nullable
      - `billing_subscription` integer, nullable — If set, credits and billing are managed by this subscription (company-level billing). NULL means this subscription manages its own billing (is a primary billing subscription).
      - `organization` integer, nullable
    - `warnings_settings` WarningsSettings, required — Schema-only mirror of the WarningsSettings pydantic model. Never used at runtime — get_warnings_settings validates through pydantic; this exists so the generated schema types the field (was string). Keep the fields in lockstep with utils.keywordsai_types.types.WarningsSettings.
      - `fallback` boolean
      - `retry` boolean
      - `invalid_json` boolean
      - `stream_timeout` boolean
      - `empty_response` boolean
      - `using_keywordsai_credentials` boolean
    - `custom_property_index_mapping` object, nullable — Custom property key -> indexed ClickHouse column name (e.g. custom_string_1).
    - `has_provider_keys` boolean, required
    - `has_api_keys` boolean, required
    - `sibling_organizations` OrganizationList[], required
      - `id` string, required
      - `unique_organization_id` string
      - `name` string, required
      - `logo` string, uri, nullable
    - `is_blocked` boolean, required
    - `has_api_call` boolean, required
    - `has_api_call_with_non_default_key` boolean, required
    - `created_at` string, date-time, nullable
    - `first_api_call_at` string, date-time, nullable
    - `last_api_call_at` string, date-time, nullable
    - `logo` string, uri, nullable
    - `notes` string
    - `name` string, required
    - `digest_email_inboxes` string[]
    - `organization_size` integer
    - `product_use_cases` string[]
    - `prioritize_objectives` string[]
    - `unique_organization_id` string
    - `budget_goal` string
    - `monthly_spending` number, double
    - `preset_models` string[]
    - `preset_option` string
    - `dynamic_routing_enabled` boolean
    - `fallback_model_enabled` boolean
    - `fallback_models` string[]
    - `alert_settings` unknown
    - `system_fallback_enabled` boolean
    - `alerts_enabled` boolean
    - `disable_log` boolean
    - `status` 'active' | 'deleting' | 'inactive', required — * `active` - Active * `deleting` - Deleting * `inactive` - Inactive
    - `stripe_customer_id` string, required
    - `onboarded` boolean
    - `onboarding_integration_options` unknown
    - `onboarding_key` string
    - `gateway_onboarding_completed_at` string, date-time, nullable
    - `tracing_onboarding_completed_at` string, date-time, nullable
    - `curr_onboarding_step` integer
    - `onboarding_start` string, date-time
    - `onboarding_end` string, date-time, nullable
    - `enable_cache` boolean
    - `archive_duration` integer
    - `cache_saved_cost` number, double
    - `cache_hit_count` integer
    - `cache_hit_tokens` integer
    - `omit_log_when_cache_hit` boolean
    - `cache_saved_time` number, double
    - `last_cache_aggregations_update` string, date-time
    - `classification_percentage` number, double, nullable
    - `use_custom_credentials` boolean
    - `default_customer_user_budget` number, double, nullable
    - `llm_gateway_markup_rate` number, double, required — LLM gateway markup rate (default 0% markup). Applied when Keywords AI provides LLM credentials. Formula: credit_charge = cost * (1 + llm_gateway_markup_rate)
    - `credit_low_balance_threshold` number, double, nullable — Credit balance threshold (in USD) to trigger low balance warning webhook. When credit balance drops below this value, a credit_low_balance_threshold_reached webhook event is dispatched once until balance goes above threshold again.
    - `credit_auto_top_off_threshold` number, double, nullable — Credit balance threshold (in USD) to trigger auto top-off. When credit balance drops below this value, automatically charge credit_auto_top_off_amount via Stripe.
    - `credit_auto_top_off_amount` number, double, nullable — Amount (in USD) to automatically charge when credit balance drops below credit_auto_top_off_threshold. Requires stripe_customer_id with valid payment method.
    - `is_auto_top_off_enabled` boolean — Enable automatic credit top-off. When enabled and balance drops below credit_auto_top_off_threshold, automatically charges credit_auto_top_off_amount via Stripe. Requires stripe_customer_id with valid payment method.
    - `metadata_keys` string[], nullable
    - `custom_models` string[], nullable
    - `spend_cap` number, double, nullable — Spend cap amount in USD. Enforced in real-time via atomic Redis limiter.
    - `spend_cap_warning_threshold` number, double, nullable — Spend threshold in USD to trigger warning alert.
    - `budget_duration` 'daily' | 'weekly' | 'monthly' — * `daily` - daily * `weekly` - weekly * `monthly` - monthly
    - `use_keywordsai_credentials` boolean
    - `rate_limit` number, double, nullable
    - `customer_user_rate_limit` number, double, nullable
    - `retry_enabled` boolean
    - `retry_after` number, double
    - `num_retries` integer
    - `custom_preset_models` string[]
    - `image_assets` string[]
    - `logs_retention_period_in_days` integer, nullable
    - `is_extended_retention_enabled` boolean
    - `is_custom_retention_enabled` boolean
    - `starred` boolean
    - `is_span_behaviors_enabled` boolean
    - `curr_owner` integer, nullable
    - `users` integer[], required

---

[API](https://skmtc.net/keywordsai/apis/api-reference.md) · [All operations](https://skmtc.net/keywordsai/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/keywordsai/api-reference/versions/c26d550029f8/schema)
