# APIs and versions

Most apps have one API. With nothing declared, there is one API, `main`,
at `/`.

An app with several audiences, such as its own clients, an admin team,
partners and webhooks, declares its APIs in `app.jadpo`, as it declares
stores:

```jadpo
// app.jadpo
application {
    apis: {
        main: {
            prefix: /v1
            authentication: [AuthenticationMethod.browser_session, AuthenticationMethod.api_token]
        }
        admin: {
            prefix: /admin
        }
        webhooks: {
            prefix: /webhooks
        }
    }
}

// domains/ordering/routes/admin_orders.jadpo
routes AdminOrders {
    prefix: /admin/orders
    api: admin
    ...
}
```

A route group names its API with `api:`, and is in `main` when it says
nothing. Its prefix starts with its API's.

Each API has its own OpenAPI document, its own record and its own default
sign-in. Its entry lists the sign-in methods it accepts: here, a browser
session or an API token for `main`. A route group or a route can accept
fewer of them, but never add one
([Apps with more than one API](routes-signed-in-by-default.md#apps-with-more-than-one-api)).
Each API serves its OpenAPI document at `<prefix>/openapi.json`, unless its
entry says `serve_openapi: false` ([OpenAPI](openapi.md)).

## A new major version

A new major version is another API, `v2: { prefix: /v2 }`. Declare one only
when a breaking change must live beside the old version. When you delete
`v1`, the compiler reports every group and type left unused.
