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

# Bootstrap projects

> Create a project, tables, seed records, indexes, and initial tokens from one JSON payload.

The bootstrap endpoint is the fastest way to create a ready-to-use project from a template.

Instead of calling the project, table, records, index, and token endpoints one by one, your backend sends one JSON payload to `POST /bootstrap` with the starting schema and data.

## When to use bootstrap

Use `POST /bootstrap` when you want to:

* create projects from a repeatable app template
* load multiple tables at once
* insert starter records during setup
* create indexes as part of the initial schema
* mint the first Project API Token for the new project

For normal day-to-day changes to an existing project, use the table, column, record, query/index, and token endpoints directly.

## Authentication

Bootstrap uses a Project API Token:

```bash theme={null}
-H 'Authorization: Bearer pat_PROJECT_TOKEN'
```

The new project is created on the same ZangTable account as that token. Keep Project API Tokens on your backend/server only.

## Minimal template

```bash theme={null}
curl -X POST "$BASE_URL/bootstrap" \
  -H 'Authorization: Bearer pat_PROJECT_TOKEN' \
  -H 'Content-Type: application/json' \
  --data '{
    "project_slug": "support_app",
    "project_name": "Support App",
    "initial_project_user": {
      "username": "server",
      "password": "replace-with-a-long-password"
    },
    "tables": [
      {
        "table_name": "tickets",
        "columns": [
          {"column_name": "id", "column_type": "INTEGER", "is_primary": true, "is_nullable": false},
          {"column_name": "subject", "column_type": "TEXT", "is_nullable": false},
          {"column_name": "status", "column_type": "TEXT", "default_value": "open"}
        ],
        "seed": [
          {"subject": "First ticket", "status": "open"}
        ]
      }
    ]
  }'
```

## Mint a token for the new project

Add `project_api_tokens` when you want bootstrap to return a Project API Token for the new project:

```json theme={null}
{
  "project_api_tokens": [
    {
      "account_user_id": 123,
      "token_name": "support-app-server"
    }
  ]
}
```

`account_user_id` must be an active user on the same ZangTable account. For the common single-admin setup, use the account user ID tied to the Project API Token making the request.

Raw tokens are shown only once in the response, so store them securely.

## Add indexes

Indexes can live inside a table definition:

```json theme={null}
{
  "table_name": "tickets",
  "columns": [
    {"column_name": "id", "column_type": "INTEGER", "is_primary": true, "is_nullable": false},
    {"column_name": "status", "column_type": "TEXT"},
    {"column_name": "created_at", "column_type": "TEXT"}
  ],
  "indexes": [
    {"columns": ["status"]},
    {"columns": ["created_at"]}
  ]
}
```

Or at the top level:

```json theme={null}
{
  "indexes": [
    {"table_name": "tickets", "columns": ["status", "created_at"], "index_name": "idx_tickets_status_created"}
  ]
}
```

## Reference

See [POST /bootstrap](/reference/service/bootstrap-project) for the full request and response shape.
