Skip to main content

Database tables

The gateway keeps its state in one PostgreSQL database. This page is a map of that database for operators, privacy reviewers and auditors. It lists every table, grouped by what the tables are for, and says in plain words what each group holds, whether it can hold prompts or personal data, how long rows are kept, how to remove them and which part of the gateway writes them. It describes tables, not their columns.

For the rules that decide when the text of a request is kept, read what Spanway stores first. That page also covers the stores outside this database, such as Lens and your logging integrations.

A real-world example​

Your privacy team is preparing a record of processing before the gateway goes live. They need to know which tables can hold the prompts your staff type, which tables name people, and what deletes those rows. They read the groups below, set a retention period for each table that matters to them, and run the cleanup once to confirm that old rows go away.

How to review and purge the database​

  1. Find the group for the data you care about in the sections below. Each group ends with the list of its tables.

  2. Read whether the group can hold prompts or personal data, and which setting or action removes it.

  3. In the Admin UI, open Settings, then Compliance, then the Retention tab (/ui/compliance). Type a period such as 90d into Retention period for each table you want to expire, then click Save changes.

  4. To change the same periods from a script, send them to the compliance API.

    curl -X PATCH http://localhost:4000/compliance/retention \
    -H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \
    -d '{"maximum_spend_logs_retention_period": "30d", "maximum_workflow_run_retention_period": "30d"}'
  5. To delete expired rows now instead of waiting for the next scheduled run, click Run cleanup now on the Retention tab, then Run cleanup in the dialog that opens, or call the run endpoint.

    curl -X POST http://localhost:4000/compliance/retention/run \
    -H "Authorization: Bearer $SPANWAY_MASTER_KEY"

Expected result​

The run answers with one entry per table it pruned, the number of rows it deleted and why it stopped. exhausted means no expired rows are left, and batch_cap_reached means the next run carries on.

{
"ran": true,
"results": [
{"table_name": "Spanway_SpendLogs", "rows_deleted": 1840, "stop_reason": "exhausted"}
]
}

GET /compliance/retention lists every period with its table and the time of the last cleanup run. Retention periods and the compliance API are an enterprise feature, described in full under compliance retention.

Errors​

StatusMessageMeaning and fix
400no retention period givenThe PATCH /compliance/retention body named no period. Send at least one, for example {"maximum_spend_logs_retention_period": "30d"}.
422A detail list naming the field, for example retention period must be positiveA period is not a positive duration such as 30d, 12h or 90d, or the body names a field that is not a retention period. Fix the value or the field name.
403The 'compliance' feature needs a Spanway enterprise license that includes it.Retention periods need the compliance feature. The cleanup still honours periods set in the config file.

The full list is in the compliance Errors section.

Logs​

The cleanup job writes INFO lines to the gateway log at every run, whether it was scheduled or started from the Retention tab. Lines for a group only appear when its period is set.

LevelLineMeaning
INFORemoving logs older than <time>A run started for the request logs, with the cutoff it uses.
INFODeleted <n> logs, Deleted <n> expired tool index rows, Deleted <n> expired guardrail index rowsRows removed from the request logs and their two lookup tables. Other groups write the same kind of line, for example Deleted <n> expired workflow trigger fires or Deleted <n> expired audit log rows.
INFOSpend log cleanup run finished: outcome=completed elapsed=<s>s [...]The run finished, with the rows deleted per table.
WARNINGSpend log cleanup run finished: outcome=aborted ... or outcome=failed ...The run stopped early, usually because the database was slow or unreachable. The next run carries on. Check the database if it repeats.
INFOMax batches reached for <table> cleanup, remaining rows will be deleted in next runA large backlog. Normal after you first set a period.
WARNINGInvalid <setting> value: <value>, using default ...A period in the config file is not a valid duration. Fix it to a value such as 30d.

Every period the job reads is listed under spend logs and retention in the settings reference.

Things that apply to every table​

A self-hosted gateway keeps every row until you set a retention period or delete it. Spanway Cloud applies two periods on its own while you leave them unset, 30 days for request logs and 90 days for the personal details of closed Cloud tenants.

The gateway is the only program that writes to this database. "Written by" below names the part of the gateway that does it, such as the request path that serves model calls, the management API that the Admin UI and spanwayctl call, or a background job that runs inside the gateway.

Virtual keys are stored as one-way hashes, never as the key itself. Provider credentials, MCP server credentials, per-user connections and similar secrets are encrypted with SPANWAY_SALT_KEY before they are written. Keep that key safe, because the gateway cannot read those rows without it.

Data subject requests export and erase a person's rows across the tables that name people. Erasure replaces the person with a pseudonym where a row has to stay, for example in request logs and daily spend rollups. Audit log rows are hash chained and are not rewritten, so earlier rows that name the person stay until maximum_audit_log_retention_period removes them.

Keys, sign-in and access​

What it holds. Virtual keys and their settings, keys kept alive during a rotation, the archive of deleted keys, mappings from signed tokens to keys, single sign-on settings and connections, verified domains, multi-factor sign-in secrets and pending challenges, invitation links, custom roles, access groups, the permissions attached to keys, teams and users, and access requests.

Prompts and personal data. No prompts. Personal data, yes. Keys and access requests name their owner and reviewer, invitations name the invited person, sign-in rows link to a user and their identity provider, and the deleted key archive names key owners and who deleted them. Sign-in secrets are encrypted.

Retention and how to purge. Live keys, roles and settings stay until an admin deletes them. Keys replaced during a rotation are removed when their grace period ends, and sign-in challenges are removed once they expire. Keys minted by workload identity are deleted by an hourly job once they have been expired for workload_identity.expired_key_retention_hours (24 by default), and they skip the deleted keys archive. The archive of deleted keys follows maximum_deleted_record_retention_period, settled access requests follow maximum_access_request_retention_period and invitation links follow maximum_invitation_retention_period.

Written by. The management API, when admins create keys, roles and access groups, and the sign-in flow, when people sign in with single sign-on or a second factor. The key rotation job writes and removes rotated keys. Access requests are written by the people who raise them and by the approvers who decide them, through the access request routes, the Admin UI and the admin MCP server. The access request expiry job moves a temporary budget or rate limit raise to expired once it ran out and its old limits are back. SCIM provisioning creates, updates, blocks and deletes keys when a directory deactivates or removes a user. The key expiry notice job records in each key's metadata when its expiry emails were sent. A key's data policy is kept in its metadata under data_policy, and only proxy admins can change it. The workload identity token exchange creates short lived keys for trusted workloads, and JWT auto registration creates a key and a JWT key mapping the first time an unknown JWT client calls.

Tables: Spanway_VerificationToken, Spanway_DeprecatedVerificationToken, Spanway_DeletedVerificationToken, Spanway_JWTKeyMapping, Spanway_UserMFA, Spanway_MFAChallenge, Spanway_SSOConfig, Spanway_OrgSSOConnection, Spanway_OrgSSODomain, Spanway_SSOIdentityAssertion, Spanway_VerifiedSubject, Spanway_InvitationLink, Spanway_RoleTable, Spanway_AccessGroupTable, Spanway_ObjectPermissionTable, Spanway_AccessRequestTable, Spanway_UserNotifications.

Organizations, teams and users​

What it holds. Organizations, teams, projects, users, end users (the customers of your own apps that you pass to the gateway), who belongs to which team and organization, team model aliases, and the archive of deleted teams.

Prompts and personal data. No prompts. Personal data, yes. User rows hold email addresses, names, roles and a password hash when local sign-in is used, and team rows list their members. Users created by SCIM also carry the directory profile in their metadata: given and family name, enterprise attributes such as department and manager, entitlements, directory roles and the active flag. Organization rows can carry a maximum key lifetime in their metadata. Team and organization data policies are kept in their metadata under data_policy. Team rows can also hold the encrypted third-party credentials of the team's own logging destinations in metadata.logging.

Retention and how to purge. Rows stay until an admin deletes the user, team, organization or customer. The archive of deleted teams follows maximum_deleted_record_retention_period. End user ids are whatever your application sends, often an account id or an email, so treat them as personal data. Erasing a user or end user through a data subject request removes or pseudonymises their rows here.

Written by. The management API, the sign-in flow when single sign-on creates or updates a user or places them in an organization, SCIM provisioning when an identity provider creates, updates, deactivates or deletes users and the teams behind its groups, and the request path, which creates an end user row with its spend the first time a customer id is billed.

Tables: Spanway_OrganizationTable, Spanway_OrganizationMembership, Spanway_TeamTable, Spanway_TeamMembership, Spanway_DeletedTeamTable, Spanway_ProjectTable, Spanway_UserTable, Spanway_EndUserTable, Spanway_ModelTable.

Budgets and spend​

What it holds. Budgets and rate limits, spend inside the current budget window, tags with their budgets, daily totals of tokens, cost, requests and errors per user, team, organization, end user, agent, tag, tool, model and gateway route, the alerts inbox of users and keys whose usage was far above their own baseline and of online eval rules whose pass rate dropped, and the saved queries and charts people keep on Query and Explore.

Prompts and personal data. No prompts. The daily totals are numbers, but the per-user and per-end-user rows are keyed by the person's id and the key that made the calls. Alerts name the user id or key hash they are about and the admins who acknowledged, own and resolved them. Saved queries and charts hold a name, a description, the SQL or chart settings and the owner's user id, never query results.

Retention and how to purge. The daily tag totals follow maximum_daily_tag_spend_retention_period. Every other daily total is kept until you delete it, so delete old rows yourself if your policy needs it. Erasing a user or end user through a data subject request removes or pseudonymises their daily rows. Resolved alerts are deleted 90 days after they were resolved, and erasing a user pseudonymises the alerts that name them. Saved queries and charts are kept until their owner or a proxy admin deletes them, and erasing a user deletes the ones they own.

Written by. The request path, which adds each request's tokens and cost to these totals in batches, the management API for budgets and tags, the hourly usage anomaly scan, the 5 minute online eval check and the /alerts/inbox routes for alerts, and the /analytics/saved routes for saved queries and charts.

Tables: Spanway_BudgetTable, Spanway_BudgetWindowSpend, Spanway_ModelAccessGroupBudgetTable, Spanway_TagTable, Spanway_DailyUserSpend, Spanway_DailyGlobalSpend, Spanway_DailyOrganizationSpend, Spanway_DailyEndUserSpend, Spanway_DailyAgentSpend, Spanway_DailyTeamSpend, Spanway_DailyTagSpend, Spanway_DailyToolSpend, Spanway_DailyModelUsage, Spanway_DailyGatewayRequests, Spanway_DailyGatewayFailedRequests, Spanway_DailyRequestErrors, Spanway_AlertInboxTable, Spanway_AnalyticsSavedQuery.

Request logs​

What it holds. One row per request with who sent it, which model served it, tokens, cost, timing and outcome, plus two small lookup tables that find the latest requests for a guardrail, policy or tool, and the comments people leave on agent traces. The legacy error log table is no longer written but can still hold rows from older versions.

Prompts and personal data. Yes, both. Prompts, responses and tool inputs and outputs are stored only when store_prompts_in_spend_logs is on and no zero data retention policy applies, as described in what Spanway stores. Every row names the key, user, team and end user, and the caller's IP address and user agent. Legacy error log rows can hold request bodies. Trace comments hold the text people typed, which can quote a prompt, and the user id or key alias of their author.

Retention and how to purge. Request logs and both lookup tables, for tools and for guardrails and policies, follow maximum_spend_logs_retention_period. Legacy error logs follow maximum_error_log_retention_period, never longer than the request logs once it is set. Erasing a person through a data subject request pseudonymises their request log rows and empties any stored prompt and response. Trace comments expire with the runs they sit on. Once a comment is older than AGENT_TRACING_RETENTION_DAYS (14 days by default, set the same value on the gateway as on Lens) the gateway deletes it within the hour and writes an audit row. Before that, its author or a proxy admin can delete it, and erasing a user deletes every comment they wrote.

Written by. The request path, through a write queue that batches rows so logging never slows down a request, and the /v1/traces/{trace_id}/comments routes for trace comments, which the hourly comment retention job deletes again.

Tables: Spanway_SpendLogs, Spanway_ErrorLogs, Spanway_SpendLogGuardrailIndex, Spanway_SpendLogToolIndex, Spanway_TraceComment.

Models, providers and gateway settings​

What it holds. Models and deployments added through the Admin UI, provider credentials, gateway settings saved from the Admin UI, cache and UI settings including the text of the dashboard banner, secret manager connections (HashiCorp Vault and CyberArk Conjur) saved from the Admin UI, logo images uploaded for the Admin UI, routing presets, budget tier policies, model health check results, status page incidents, the list of running gateway processes, scheduled job locks, pending billing for background provider calls, and the plugin catalogue for coding agents.

Prompts and personal data. No prompts. Health check rows can keep the error text a provider returned for the health check call. Model rows keep a deployment's declared data terms (data_retention, trains_on_data, data_region, data_policy_note, self_hosted, azure_deployment_type) in model_info, and the general_settings row of Spanway_Config keeps required_model_region and enforce_required_model_region. Model and credential rows name the admin who created and last changed them, status page incident rows keep the user id of the admin who opened them in created_by and their public-facing text, and each routing preset version keeps the user id of the admin who saved it in created_by. A budget tier policy row keeps the user id of the admins who created and last changed it, next to the team or organization id it covers and its current tier. Credentials are encrypted, and so are the Vault token, AppRole secret id, client key and Conjur API key of a saved secret manager connection, with the salt key. Spanway_Config also holds the encrypted API keys and integration token of the CloudZero and Vantage cost exports, in the cloudzero_settings and vantage_settings rows. Custom pass-through endpoints live in the general_settings row too, and a header value typed as a literal, such as a bearer token, is stored there in plain text, while an os.environ/ reference keeps only the variable name. Uploaded logos are the images an admin picked, stored base64 encoded at up to 5 MB each, and anyone can download them from /get/ui_logo/<name> without signing in, so upload only images that may be public. The environment_variables row of Spanway_Config holds the encrypted credentials of gateway wide logging destinations saved from the Admin UI, and they stay there after a destination is deleted until an admin clears them.

Retention and how to purge. Settings, models and credentials stay until an admin removes them. Deleting a routing preset only marks it deleted, so its versions, including created_by, stay in Spanway_RoutingPresetTable and no route purges them. A database administrator removes them by deleting the rows whose deleted_at is set. A budget tier policy stays until an admin removes it with DELETE /routing/tier_policies/{scope_type}/{scope_id}, which deletes its row. Removing a team or organization does not remove its policy, so remove the policy first. Uploaded logos are never removed by the gateway, even when no theme uses them any more, and no route deletes them yet, so a database administrator removes old ones by deleting the Spanway_Config rows whose name starts with ui_logo: and is not the logo in use. The rows of the retired ROI calculator in Spanway_Config (roi_calculator_settings, which held encrypted code-hosting tokens, its report, sync and cached pull rows, and its sign-in state rows) are deleted by a database migration on upgrade to 2.0.0, so no install keeps those tokens. Health checks follow maximum_health_check_retention_period. Status page incidents are kept indefinitely, no route deletes one and no retention period covers them, so a mistaken public incident can only be made private with PATCH /status/incidents/{incident_id}. A data subject erasure of the admin who opened one replaces created_by with the pseudonym. Gateway process rows are removed when a process stops or stops reporting, and job locks expire on their own.

Written by. The management API for models, credentials and settings, the /config_overrides routes for secret manager connections, the /routing/presets routes for presets, the /routing/tier_policies routes and the request path for budget tier policies and their current tier, the health check job for health results, the /status/incidents routes for status page incidents, and every gateway process for its own heartbeat and job locks.

Tables: Spanway_ProxyModelTable, Spanway_CredentialsTable, Spanway_Config, Spanway_ConfigOverrides, Spanway_CacheConfig, Spanway_UISettings, Spanway_RoutingPresetTable, Spanway_TierPolicyTable, Spanway_HealthCheckTable, Spanway_StatusIncidentTable, Spanway_ProxyWorkerHeartbeat, Spanway_CronJob, Spanway_BackgroundInteractionSettlement, Spanway_ClaudeCodePluginTable.

Routing​

What it holds. What the adaptive router and the auto routers have learned about which model serves which kind of request, per-session routing statistics, daily router savings, and shadow evaluations that compare the chosen model with another one.

Prompts and personal data. No prompts. Message content is never stored in these tables. Session rows are keyed by the key and session id, and the per-user session rows by the user id.

Retention and how to purge. Auto router session and daily rows follow maximum_autorouter_session_retention_period, and so do the savings baseline rows (Spanway_AutoRouterBaselineComparison is marked retired and its history cleared, then its Spanway_AutoRouterBaselineObservation rows are deleted). Adaptive router sessions follow maximum_adaptive_router_session_retention_period. Learned model scores in Spanway_AdaptiveRouterState are kept forever, and deleting a router does not remove them, so a database administrator removes them by deleting the rows of that router. Shadow evaluation jobs, their attempts and their sample counts stay forever, because no route deletes them and deleting a router leaves them in place. A database administrator removes old ones by deleting Spanway_ShadowEvalJob rows together with the Spanway_ShadowEvalAttempt and Spanway_ShadowEvalFunnel rows of the same job.

Written by. The request path, when a router picks a model, and the shadow evaluation job.

Tables: Spanway_AdaptiveRouterState, Spanway_AdaptiveRouterSession, Spanway_AutoRouterBaselineComparison, Spanway_AutoRouterBaselineObservation, Spanway_AutoRouterSession, Spanway_AutoRouterUserSession, Spanway_AutoRouterDailySpend, Spanway_ShadowEvalJob, Spanway_ShadowEvalAttempt, Spanway_ShadowEvalFunnel.

Guardrails and policies​

What it holds. Guardrail definitions, guardrail policies and their versions, where each policy applies, and daily counts of how often each guardrail and policy passed, blocked or flagged a request.

Prompts and personal data. No prompts. The daily usage rows name the team and key that used a guardrail. A team guardrail submission records the submitter's user id and email, kept until the guardrail is deleted, and a custom code guardrail stores its source code. Guardrail credentials are encrypted.

Retention and how to purge. Definitions and policies stay until an admin deletes them. The daily counts are kept until you delete them.

Written by. The management API for guardrails and policies, and the request path for the daily counts.

Tables: Spanway_GuardrailsTable, Spanway_DailyGuardrailMetrics, Spanway_DailyGuardrailUsageUnits, Spanway_DailyPolicyMetrics, Spanway_PolicyTable, Spanway_PolicyAttachmentTable.

MCP, tools and skills​

What it holds. MCP servers and toolsets, the credentials and settings each user saves to connect to a server or a provider, the registry of tools seen in request tool lists, model tool calls and MCP tool calls with their policies, search tools and skills.

Prompts and personal data. No tool arguments. Skill rows are prompt content, because a skill's instructions and files are written by key holders and the gateway copies them into the prompt when a request asks for the skill. Per-user credentials are tied to the user and are encrypted. The tool registry records the key and user agent that called each tool.

Retention and how to purge. Server rows stay until an admin removes them, and a skill row stays until its owner or an admin deletes it, and a user's saved connection goes when the user disconnects. A tool registry row stays until an admin deletes it on Tool Policies or with DELETE /v1/tool/{tool_name}, which also removes its key hash, key alias and user agent. Erasing a user through a data subject request deletes their saved credentials and clears the key hash, key alias and user agent on every tool their keys discovered, and the export lists those tools.

Written by. The management API, the connect flow when a user links an account, and the request path, which adds newly seen tools to the registry.

Skill scan rows hold the guardrail result for each uploaded skill and marketplace plugin: the file paths, each verdict and reason and who added the item, never the file contents. Who added the item is a user id or key alias, so the rows hold personal data: a data subject export lists them and an erasure replaces the user id with the pseudonym. A skill's or plugin's scan rows are deleted with it, also when it is deleted through the Anthropic pass-through route, and the rows of refused uploads stay as a record of what was refused. No retention setting removes them. They are written when a skill or plugin is added or changed, see skill scanning.

Tables: Spanway_MCPServerTable, Spanway_MCPToolsetTable, Spanway_MCPUserCredentials, Spanway_MCPUserEnvVars, Spanway_MCPServerOAuthClient, Spanway_UserProviderCredentials, Spanway_ToolTable, Spanway_SearchToolsTable, Spanway_SkillsTable, Spanway_SkillScanTable.

Agents​

What it holds. Registered agents, custom agent definitions, each custom agent run with its steps and events, the workload identities bound to agents, and the stored credentials of agents with their suspension switch.

Prompts and personal data. Yes, both. A custom agent run keeps its input, answer and transcript only when prompts are stored and no zero data retention policy applies, otherwise they are redacted. Runs name the user, team and key that started them. The credentials an agent is called with, such as provider keys in its settings, header values sent to it and the kill switch webhook secret, are encrypted with the gateway's salt key before they are saved. Stored agent credentials hold the agent's API keys and tokens for MCP servers and SaaS tools, encrypted with AES-256-GCM under the salt key and bound to the agent and credential id, and name the admins who created, rotated or revoked them.

Retention and how to purge. Runs and their events follow maximum_custom_agent_run_retention_period, never longer than the request logs. Agent definitions stay until an admin deletes them. A stored credential stays until an admin deletes it with DELETE /v1/agents/{agent_id}/credentials/{credential_id}, revoking it erases its secret at once, and deleting the agent deletes its credentials and suspension. Erasing a user through a data subject request deletes the runs they started.

Written by. The management API for agents, the /v1/agents/{agent_id}/credentials routes for stored credentials, the gateway itself for a credential's last used time, and the custom agent runner inside the gateway for runs.

Tables: Spanway_AgentsTable, Spanway_CustomAgentSpec, Spanway_CustomAgentRun, Spanway_CustomAgentRunEvent, Spanway_AgentIdentity, Spanway_AgentCredential, Spanway_AgentCredentialSuspension, Spanway_RetiredAgentIdentity, Spanway_RetiredAgent.

Workflows​

What it holds. Saved workflow definitions and their versions, workflow runs with their steps, attempts, events, messages and failures, test data pinned to a step, workflow variables, installed templates, triggers with their fire history and pending events, runner processes, and agents halted by a kill switch.

Prompts and personal data. Yes, both. Run inputs, outputs and step messages are kept only when the run captures content, prompts are stored and no zero data retention policy applies. Captured step content is encrypted. Trigger fires keep the input that started them, encrypted. Runs, pins and triggers name the user and team that own them. The access mapping of a connected service trigger pairs outside identities, such as Slack or Teams member ids, Microsoft user ids and mailbox or calendar addresses, with gateway users.

Retention and how to purge. Runs and everything recorded under them follow maximum_workflow_run_retention_period, never longer than the request logs, and a run that is still being driven is kept. Trigger fires are deleted after workflow_triggers.fire_retention_days (30 by default) or maximum_workflow_trigger_fire_retention_period, whichever is shorter. Finished and failed events waiting to become fires are deleted after workflow_triggers.fire_retention_days only. Definitions, templates and triggers stay until their owner deletes them. Erasing a user through a data subject request deletes or pseudonymises their runs, pins, triggers and definitions, and removes them from the access mapping of other people's triggers.

Written by. The workflow runner inside the gateway for runs, the trigger dispatcher for fires, and the management API for definitions, templates and triggers.

Tables: Spanway_WorkflowRun, Spanway_WorkflowEvent, Spanway_WorkflowMessage, Spanway_WorkflowExecution, Spanway_WorkflowPin, Spanway_WorkflowStep, Spanway_WorkflowStepAttempt, Spanway_WorkflowDeadLetter, Spanway_WorkflowDefinition, Spanway_WorkflowDefinitionVersion, Spanway_WorkflowVariable, Spanway_WorkflowDefinitionRef, Spanway_WorkflowWorker, Spanway_WorkflowTemplateInstall, Spanway_WorkflowAgentHalt, Spanway_WorkflowTrigger, Spanway_WorkflowTriggerFire, Spanway_WorkflowEventOutbox.

Approvals​

What it holds. Human approval policies, a version counter that tells every gateway when to reload them, approval requests for tool calls and workflow steps with their lanes, and each approver's decision. No history of policy changes is kept here, the audit log holds each policy before and after every change.

Prompts and personal data. Yes, prompt-like content. A request for a tool call keeps a masked preview of the tool's arguments, and a request for a workflow step keeps a masked preview of the message the step sends to its agent, each up to 4,000 characters, so the approver knows what they approve. Secret-looking values are masked before the preview is saved. Requests name the requester, and decisions name the approver and their note.

Retention and how to purge. Settled requests with their decisions follow maximum_approval_request_retention_period. Pending requests are kept. Policies stay until an admin deletes them.

Written by. The request path and the workflow runner, when a call needs approval, the Admin UI and management API, when an admin writes a policy or an approver decides, and the gateway's background sweep, as system:approvals, when it expires or escalates a request.

Tables: Spanway_ApprovalPolicy, Spanway_ApprovalPolicyRevision, Spanway_ApprovalRequest, Spanway_ApprovalLane, Spanway_ApprovalDecision.

Evals and red team​

What it holds. Eval datasets and their versions, eval runs with their results and transcripts, schedules, remote scorers, online scoring rules with their saved versions, backfill jobs and scores, end-user feedback, review queues with their items, labels and the reviewer an admin assigned each item to, and red team runs with their results.

Prompts and personal data. Yes, both. Datasets hold the inputs and expected outputs you chose to keep or copied from logs. Eval results, transcripts and red team results copy model outputs and the attack inputs that produced them. Review items copy the request or result they review. Feedback can carry the comment an end user sent. Online scores keep the judge's reason only when prompts are stored.

Retention and how to purge. Eval runs follow maximum_eval_run_retention_period and red team runs maximum_red_team_run_retention_period, both never longer than the request logs once set. Saved rule versions and backfill job records hold only settings and counts, no prompts, and are deleted with their rule. Online scores, review items, feedback and dataset items copied from logs each have their own period and never outlive the request logs. Datasets you typed in or imported stay until you delete them.

Written by. The eval and red team runners and the online scoring job inside the gateway, the feedback API your apps call, and reviewers working in the Admin UI.

Tables: Spanway_EvalDatasetTable, Spanway_EvalDatasetVersion, Spanway_EvalRunTable, Spanway_EvalResultTable, Spanway_EvalTranscriptTable, Spanway_EvalScheduleTable, Spanway_EvalRemoteScorerTable, Spanway_EvalFeedback, Spanway_OnlineEvalRuleTable, Spanway_OnlineEvalScoreTable, Spanway_OnlineEvalFunnelTable, Spanway_OnlineEvalRuleVersionTable, Spanway_OnlineEvalBackfillTable, Spanway_EvalReviewQueueTable, Spanway_EvalReviewItemTable, Spanway_EvalReviewLabelTable, Spanway_RedTeamRunTable, Spanway_RedTeamResultTable.

Prompts, memory, files and vector stores​

What it holds. Saved prompt templates, reusable prompt partials, the prompt protection and change alert settings, the Git repositories prompts are synced with (with the repository access token stored encrypted), memories, managed files and the batches and fine-tuning jobs built from them, file contents when files are stored in the database, vector store definitions, and one row per code interpreter container that records which user, team, organization or key owns it.

Prompts and personal data. Yes, both. Everything here is content you or your apps saved on purpose, and memories and files can name people.

Retention and how to purge. Prompt partials stay until you delete them, and a partial that a saved prompt still uses cannot be deleted. The prompt settings row and repository connections stay until you change or delete them. Memories follow maximum_memory_retention_period. Managed files and the file contents kept in the database follow maximum_managed_file_retention_period, but copies already uploaded to a provider are not deleted, so delete those through the files API first. Prompt templates and vector store definitions stay until you delete them. Batch and fine-tuning job records stay until they are deleted through the API. Container ownership rows hold only the container id and the owner, no prompts or files, and they stay after the container is deleted or expires, until a database administrator removes the Spanway_ManagedObjectTable rows whose file_purpose is container.

Written by. The API calls that save them, such as the prompt management, memory, files and vector store endpoints.

Tables: Spanway_PromptTable, Spanway_PromptPartialTable, Spanway_PromptOpsSettings, Spanway_PromptGitSyncTable, Spanway_MemoryTable, Spanway_ManagedFileTable, Spanway_ManagedFileContentTable, Spanway_ManagedObjectTable, Spanway_ManagedVectorStoreTable, Spanway_ManagedVectorStoresTable, Spanway_ManagedVectorStoreIndexTable.

Environment promotion​

What it holds. Environment promotion plans with the configuration bundle each one applies, the objects each environment manages, the lock that lets one apply run at a time, and a record of each export.

Prompts and personal data. Configuration prompts, not end-user prompts. A plan stores the bundle it applies, which holds custom agent instructions (their system prompts) and policy content, so treat it as sensitive. It never holds a request, a response or a secret, because bundles with inline secrets are refused. Plans and exports name who created, approved, applied or exported them, and decisions keep the approver's note.

Retention and how to purge. Expired plans and export records follow maximum_environment_record_retention_period. A plan that is being applied is kept.

Written by. The environments API, called from the Admin UI or spanwayctl.

Tables: Spanway_EnvPlan, Spanway_EnvManagedObject, Spanway_EnvApplyLock, Spanway_EnvExport.

Code graph​

What it holds. Connected repositories for the code graph, the credential each tenant may index with, index runs, and the ids of recent webhook deliveries so a replayed delivery is ignored. The symbol index itself lives in a separate schema of the same database and is removed when a repository is disconnected.

Prompts and personal data. No prompts and no source code in these tables. Repository rows and index runs name the admin who connected the repository or queued the run.

Retention and how to purge. Finished index runs follow maximum_code_index_run_retention_period and disconnected repositories maximum_code_repo_retention_period. Webhook delivery ids are kept for about a day.

Written by. The code graph API and its indexer inside the gateway, and the webhook endpoint your code host calls.

Tables: Spanway_CodeRepoTable, Spanway_CodeCredentialTable, Spanway_CodeWebhookDeliveryTable, Spanway_CodeIndexRunTable.

Compliance and audit​

What it holds. The audit log of administrative changes, the log of data subject requests, compliance report snapshots and evidence bundles.

Prompts and personal data. No prompts. The audit log names who changed what, and the before value of a change can copy the changed row, for example a deleted user's email. Read events add who viewed, revealed or exported data, with the caller's IP address, browser and the reason typed for a reveal. Erased people appear in the data subject request log only by pseudonym, except refused erasures, which keep the id because nothing was erased.

Retention and how to purge. The audit log follows maximum_audit_log_retention_period. Its entries are hash chained, so they are not rewritten on erasure, and the period bounds how long a person stays named there. Snapshots, evidence bundles and the data subject request log each have their own period.

Written by. The management API, which writes an audit entry for every administrative change and every audited read or export, and the compliance module.

Tables: Spanway_AuditLog, Spanway_DataSubjectRequestTable, Spanway_ComplianceSnapshotTable, Spanway_ComplianceEvidenceTable.

Sanctions screening​

What it holds. The versions of the sanctions lists the gateway screens against, screening cases with their decisions, the event log of every screening step, reports due to the regulator, and payments from screened customers with how each one was handled.

Prompts and personal data. No prompts. Personal data, yes. Cases and reports name the screened customer and their legal details.

Retention and how to purge. These records are kept at least 10 years, as US sanctions recordkeeping rules require. maximum_sanctions_record_retention_period refuses any shorter period, and the cleanup job never deletes these rows. Details are on sanctions screening.

Written by. The screening service inside the gateway at signup, at billing and when a list changes, and compliance staff deciding cases in the Admin UI.

Tables: Spanway_SanctionsListVersionTable, Spanway_SanctionsCaseTable, Spanway_SanctionsEventTable, Spanway_SanctionsReportTable, Spanway_SanctionsPaymentTable.

Billing and Spanway Cloud​

What it holds. Billing accounts and invoices for teams, organizations and end users, and on Spanway Cloud the tenants, their credit ledger and the daily spend on their own provider keys. Each tenant also records the data region it chose at signup, and its rows live only in that region's database.

Prompts and personal data. No prompts. Personal data, yes. Billing accounts hold a billing email, and Cloud tenants hold the email, company, legal name and address of the person who signed up. The admin's password is stored on their user, not on the tenant.

Retention and how to purge. Billing accounts stay until you delete them. Invoices are kept for bookkeeping, even after their account is deleted, and no route or Admin UI action deletes one, so a database administrator removes old invoices from Spanway_InvoiceTable directly when your bookkeeping rules allow it. A closed Cloud tenant's personal details are blanked after maximum_cloud_closed_tenant_retention_period (90 days by default on Cloud), and signups never verified are deleted after the same period. Tenants under a sanctions hold are kept.

Written by. The billing module and the callbacks from its payment provider, and on Spanway Cloud the signup and plan service.

Tables: Spanway_BillingAccountTable, Spanway_InvoiceTable, Spanway_CloudTenantTable, Spanway_CloudCreditLedgerTable, Spanway_CloudDailyByokSpend.

Outside the gateway database: the Admin Assistant state file​

What it holds. The Admin Assistant for Slack worker keeps its own small SQLite file, STATE_DB, in the admin_assistant_state volume. It holds each connected admin's encrypted gateway session, the pending connect links, identifiers of Slack events already handled so none runs twice, and a journal of who ran which tool with what status. It is not part of the gateway's Postgres database and adds no table to it.

Prompts and personal data. No prompts, tool arguments or results. Personal data, yes. Connections hold the admin's gateway user id, Slack user id and Slack email.

Retention and how to purge. Sessions end after 24 hours and links after ten minutes. Connections and the journal stay until you remove them. Sending disconnect removes one admin's connection. To purge everything, stop the worker and delete the volume.

Written by. The Admin Assistant worker only. The sessions are encrypted with CREDENTIAL_ENCRYPTION_KEY, which is kept apart from the file.