# Bootstrap Enterprise Access

> End-to-end guide for bootstrapping enterprise admin access, including auth, users, roles, and service accounts.

Source: https://business-api-docs.youhodler.com/guides/bootstrap-enterprise-access

This guide covers the minimal control-plane sequence for an enterprise
integration.

> **Purpose:** This is the shortest path from enterprise admission into an operable tenant control plane with service access, human access, and governance surfaces in place.

## Sequence

**01. Issue an access token**

_OAuth client credentials_

[API Reference](/api/reference/auth/oauth-token)

Authenticate the integration and establish the bearer token that will back
    subsequent control-plane calls.
**02. Read or admit the enterprise perimeter**

_Enterprise admission and tenant boundary_

[API Reference](/api/reference/enterprises/enterprises-list)

Establish the tenant topology boundary before creating identities,
    policies, or downstream clients inside it.
**03. Create service accounts**

_Backend-to-backend access_

[API Reference](/api/reference/service-accounts/service-accounts-create)

Create service principals for server-side integrations that need
    non-human access to the public API.
**04. Create users**

_Operator access_

[API Reference](/api/reference/users/users-create)

Add human actors that need direct tenant-facing access for operational
    review, setup, or governance tasks.
**05. Define roles, assignments, and policies**

_Authorization and controls_

[API Reference](/api/reference/roles/roles-list)

Bind actor permissions and operational restrictions before enabling
    sustained financial activity.

## Minimal Token Request

```bash
curl -X POST "$BASE_URL/oauth/token" \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "client_credentials",
    "client_id": "b8e2f1a0-4c3d-4e5f-9a1b-2c3d4e5f6a7b",
    "client_secret": "replace-me"
  }'
```

After token issuance, move into client and account topology setup.

## Extracting Your Scope Reference

The `access_token` in the response is a JWT. Before making governance calls,
find your tenant reference: the topology perimeter that endpoints taking a
`scope_ref` parameter expect.

Decode the JWT payload (the middle part, base64url-decoded) and find the
`b2b2x:tenant_ref` claim:

```json
{
  "sub": "b8e2f1a0-4c3d-4e5f-9a1b-2c3d4e5f6a7b",
  "b2b2x:tenant_ref": "enterprises/c78778b9-b517-4c7b-8393-9db034ab5708",
  "b2b2x:principal_kind": "service",
  "b2b2x:identity_source": "platform-managed"
}
```

`sub` is the bare service account id, the same value as your `client_id`.
`b2b2x:tenant_ref` identifies your tenant boundary. Pass it as `scope_ref`
where the endpoint declares that parameter. Other operations use `account_ref`,
`parent_ref`, or a path identifier; follow their endpoint reference:

```
GET  /users?scope_ref=enterprises/c78778b9-b517-4c7b-8393-9db034ab5708
POST /users  { "scope_ref": "enterprises/c78778b9-...", ... }
```

> **Start from the tenant boundary:** Use the tenant reference when addressing the enterprise itself. Operations within a client can require that client reference instead. The endpoint defines the accepted reference kinds, and your grants determine which resources you can address.
