---
name: vobiz-sub-accounts
description: Manage Vobiz sub-accounts for multi-team or multi-environment isolation - separate billing, credentials, and number pools under one parent account, including per-sub-account India KYC through Vobiz-hosted KYC sessions (Initialize KYC) and the aggregated KYC status gate.
license: MIT
compatibility: Vobiz REST API v1.
metadata:
  author: vobiz
  version: "1.1"
title: vobiz-sub-accounts
canonical_url: https://skilld.dev/gh/vobiz-ai/agent-skills/vobiz-sub-accounts
last_updated: 2026-10-29T11:16:57.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install vobiz-ai/agent-skills/vobiz-sub-accounts`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/vobiz-sub-accounts`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/vobiz-ai/agent-skills/vobiz-sub-accounts) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/vobiz-sub-accounts`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/vobiz-sub-accounts --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/vobiz-sub-accounts --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Vobiz Sub-Accounts skill

Use this when the user wants to **isolate environments** (dev/staging/prod), **separate teams** (sales vs support), or **carve their account into business units** with independent credentials, numbers, and CDR streams under the same parent wallet - and, for `customer_use` sub-accounts, **verify each customer's own KYC** before it can place calls.

## Difference from partner child accounts

| | Sub-account | Partner child account |
|---|---|---|
| Parent | Your own main account (`MA_…`) | Partner master account (`PA_…`) |
| Balance | Shared - all usage is charged to the parent wallet | Separate wallet per child, funded by balance transfer (or invoiced by Vobiz directly) |
| CPS / concurrency | One limit on the parent, pooled across every sub-account | Own limit per child, transferred/reclaimed from the partner pool |
| KYC | `personal_use` inherits parent's; `customer_use` does its own | Each child completes its own KYC via a partner KYC session |
| API | `/api/v1/accounts/{auth_id}/sub-accounts/*` | `/api/v1/partner/accounts/*` |

If the user wants customers billed, supported, and capacity-managed as independent Vobiz customers, they need the **Partner API** (see `vobiz-partner-api` skill). Sub-accounts suit one bill, one capacity pool, and your own pricing. Many platforms use both - see `concepts/sub-accounts-vs-partner-accounts`.

## Two credential pairs (the rule that prevents most bugs)

- **Parent `X-Auth-ID` / `X-Auth-Token`** (`MA_…`): used for **all provisioning and administration** - CRUD on sub-accounts, **all KYC calls**, buying/assigning/unassigning numbers. The sub-account is named by `{sub_auth_id}` in the URL.
- **Sub-account `auth_id` / `auth_token`** (`SA_…`): returned **once** at creation; the sub-account's **runtime** key for placing/receiving calls, buying its own numbers, and pulling its own CDRs.

Rule of thumb: setting it up → authenticate as the **parent**; using the service → the sub-account authenticates as **itself**. KYC is **not** an exception - it is a parent-authenticated call.

## CRUD endpoints

Base: `https://api.vobiz.ai/api/v1`. All five authenticate as the parent.

| Op | Path | Notes |
|---|---|---|
| List | `GET /accounts/{auth_id}/sub-accounts/` | Plural, lowercase `accounts`. Query: `page` (default 1), `size` (default 25), `active_only`. Response: `{sub_accounts[], total, page, size}`. |
| Create | `POST /accounts/{auth_id}/sub-accounts/` | Body: `{name, email?, phone?, description?, password?, kyc_mode?, business_type?, enabled?, rate_limit?, permissions?}`. Only `name` is required. Returns `201`. |
| Get | `GET /accounts/{auth_id}/sub-accounts/{sub_auth_id}` | `auth_token` is `<redacted>` here. |
| Update | `PUT /accounts/{auth_id}/sub-accounts/{sub_auth_id}` | Body: `{name?, email?, phone?, description?, rate_limit?, permissions?, enabled?, kyc_mode?}`. Omitted fields stay unchanged. |
| Delete | `DELETE /accounts/{auth_id}/sub-accounts/{sub_auth_id}` | Permanent; revokes credentials. Returns `200 {message}` (or `204`). Parent auth only - you don't need the lost sub-account token. |

### Create fields that matter

- `kyc_mode`: `personal_use` *(default)* inherits parent KYC; `customer_use` requires the sub-account to run its own KYC and **requires `email`** (omit it → `400`).
- `business_type` (enum): `individual`, `proprietorship`, `private_limited`, `llp`, `partnership`, `public_limited`, `trust`, `society`, `huf`, `government`. Drives which documents are required.
- `rate_limit`: defaults to `1000`. `enabled`: defaults to `true`. `permissions`: object with booleans `calls` and `cdr`; omitted → inherits the parent's default access.
- `password`: console login only; the REST credentials (`auth_id`/`auth_token`) are generated regardless.
- Errors: `400` (`customer_use` without `email`), `401` (bad credentials or wrong path casing), `404` (`{auth_id}` is not a main account you own).

### Response shape on create

```json
{
  "message": "Sub-account created successfully",
  "sub_account": { "id": "500001", "auth_id": "SA_XXXXXXXX", "auth_token": "shown-once",
                   "parent_auth_id": "MA_XXXXXXXX", "kyc_mode": "customer_use", "kyc_calls_blocked": true },
  "auth_credentials": { "auth_id": "SA_XXXXXXXX", "auth_token": "shown-once" },
  "tokens": { "access_token": "eyJ…", "refresh_token": "eyJ…", "token_type": "bearer", "expires_in": 1800 }
}
```

`sub_account.auth_id` (`SA_…`) is what later calls expect as `{sub_auth_id}`. The numeric `id` is NOT the same. `tokens` (JWT) are only for console sign-in - use `auth_id`/`auth_token` for the REST/telephony API.

## Phone numbers - assign, unassign, or let the sub-account buy

| Op | Path | Auth | Notes |
|---|---|---|---|
| Buy into parent pool | `POST /Account/{auth_id}/numbers/purchase-from-inventory` `{e164}` | Parent | Debits the parent (setup + monthly fee). Capital-A `/Account/`. |
| Assign to sub-account | `POST /account/{auth_id}/numbers/{e164}/assign-subaccount` `{sub_account_id: "SA_…"}` | Parent | **Lowercase `/account/`**, singular `assign-subaccount`. URL-encode `+` as `%2B`. `200`/`204` no body; `404` if number or sub-account not found. |
| Unassign (back to parent pool) | `DELETE /account/{auth_id}/numbers/{e164}/assign-subaccount` | Parent | **15-day cool-off**: a DID with a call in the last 15 days → `409 did_cool_off_in_effect` with `cool_off_until` / `cool_off_remaining_seconds`. Never-used DIDs move immediately. `?force=true` is admin-role only (`403` otherwise). |
| Sub-account buys its own | `POST /Account/{sub_auth_id}/numbers/purchase-from-inventory` | Sub-account | Lands directly on the sub-account; billing still routes to the parent `MA_`. |

Purchasing spends money - confirm the number and fee with the user before firing. See `sub-accounts/onboarding-flow` and `account-phone-number/unassign-subaccount`.

## KYC (customer_use only) - authenticate as the PARENT

KYC endpoints live at `/api/v1/sub-accounts/{sub_auth_id}/…` (real) or `/api/v1/sub-accounts/test/{sub_auth_id}/kyc/…` (mock) and authenticate with the **parent's** `X-Auth-ID`/`X-Auth-Token`. The sub-account is in the path. Verification itself happens in the Vobiz-hosted KYC widget: you initialize a session, the customer completes the documents there, and you read the outcome from status or webhooks.

| Op | Path | Body |
|---|---|---|
| Status | `GET .../kyc/status` | - → `{sub_account_id, kyc_mode, business_type, overall_status, kyc_calls_blocked, verifications:{pan,gst,cin,aadhaar}}`. `403` if the caller isn't the parent; `404` unknown sub-account. |
| Initialize KYC (hosted session) | `POST .../kyc-sessions` | `{account_auth_id, flow_type, customer_email? / redirect_url?, webhook_url?, expires_in_days?}` → `201`; `422` if the flow's required field is missing |

`overall_status` and each entry in `verifications` ∈ `not_started | pending | verified | failed`.

### business_type → documents the hosted widget collects

| `business_type` | Documents |
|---|---|
| `individual`, `proprietorship`, `huf` | PAN + Aadhaar (DigiLocker) |
| `private_limited`, `public_limited`, `llp`, `partnership` | PAN + GST and/or CIN |
| `trust`, `society`, `government` | PAN + supporting registration (CIN/GST as applicable) |

### Create → KYC → unblock recipe

```bash
# 1. Create a customer_use sub-account (parent auth). Returns kyc_calls_blocked: true.
curl -X POST "$BASE/accounts/$MA/sub-accounts/" -H "X-Auth-ID: $MA" -H "X-Auth-Token: $MA_TOK" \
  -H "Content-Type: application/json" \
  -d '{"name":"Acme","email":"o@acme.com","kyc_mode":"customer_use","business_type":"private_limited"}'

# 2. Initialize KYC (parent auth, sub in path). The customer completes documents in the hosted widget.
curl -X POST "$BASE/sub-accounts/$SA/kyc-sessions" -H "X-Auth-ID: $MA" -H "X-Auth-Token: $MA_TOK" \
  -H "Content-Type: application/json" \
  -d '{"account_auth_id":"'$SA'","flow_type":"email","customer_email":"o@acme.com","webhook_url":"https://example.com/kyc"}'

# 3. Poll until kyc_calls_blocked is false.
curl "$BASE/sub-accounts/$SA/kyc/status" -H "X-Auth-ID: $MA" -H "X-Auth-Token: $MA_TOK"
# -> { "overall_status":"verified", "kyc_calls_blocked": false, "verifications": {...} }

# 4. Now the sub-account places calls with ITS OWN auth_id/auth_token.
```

### Test mode (no provider, no real docs)

Magic inputs at `/sub-accounts/test/{sub_auth_id}/kyc/…`: `TESTSUCCESS0001` → verified, `TESTFAIL0001` → failed, `TESTERROR0001` → HTTP 500, `TESTPENDING001` → pending (finalize verified), `TESTPENDING_FAIL` → pending (finalize failed). GST input must still be 15 chars (`TESTSUCCESS0001` already is - pass it as-is, don't append a suffix; pad shorter magic inputs to 15). Mock CIN confirm succeeds when `selected_cin` starts with `U72900KA2024PTC123456`. DigiLocker verify: `MOCK_AR_SUCCESS`/`MOCK_AR_FAIL`. Drive the async path with `POST .../kyc/finalize-pending` `{verification_type: pan|aadhaar|gst|cin, outcome: verified|failed}`. Responses carry `mock: true`. Test mode writes **real** rows - use a throwaway sub-account.

### Hosted sessions + webhooks (callbacks)

`flow_type: "email"` (default) emails a signed link from `kyc@vobiz.ai` hosted at `kyc.vobiz.ai` (needs `customer_email`; session starts `email_sent`); `flow_type: "redirect"` returns a `widget_url` (needs `redirect_url`; session starts `link_ready`). `expires_in_days` defaults to `7`. No `webhook_url` → no callbacks. Webhook events on `webhook_url`: `kyc.initiated`, `kyc.submitted`, `kyc.completed`, `kyc.failed`, `kyc.session_expired`, `kyc.session_revoked`. Payload carries `event`, `session_id`, `account_auth_id`, `kyc_type`, `session_status`, `metadata`.

Verify every KYC webhook - header `X-Vobiz-Signature: sha256=<hex>`, HMAC-SHA256 over the **raw body**, secret = the **parent account's `auth_token`**:

```python
import hmac, hashlib
def verify(raw_body: bytes, header: str, parent_auth_token: str) -> bool:
    expected = "sha256=" + hmac.new(parent_auth_token.encode(), raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, header)
```

Return `2xx` to ack; failures are retried with exponential backoff - keep the handler idempotent.

### Voice callbacks on sub-accounts are signed differently

The scheme above is for **KYC session webhooks** only. Answer/hangup/action **call callbacks** for a sub-account use the standard callback signatures (`X-Vobiz-Signature-V2` / `-V3`, base64 HMAC-SHA256 over `url + nonce`, keyed with the **sub-account's** auth token) **plus** `X-Vobiz-Signature-MA-V2` / `X-Vobiz-Signature-MA-V3`, the same computation keyed with the **parent's** auth token - so you can validate with either key. See https://www.vobiz.ai/docs/concepts/validating-callbacks#sub-account-callbacks.

## Pitfalls

- **Path casing is significant.** Sub-account CRUD + KYC use plural, **lowercase** `accounts` / `sub-accounts` (`/api/v1/accounts/…`, `/api/v1/sub-accounts/…`); assign/unassign use lowercase singular `/api/v1/account/{auth_id}/numbers/…/assign-subaccount`; inventory, purchase, and calls use capital-A `/Account/`. The wrong casing returns 401/404 even with valid credentials.
- **KYC authenticates as the parent**, not the sub-account. The sub-account is the `{sub_auth_id}` path segment, never the `X-Auth-ID`. A caller that isn't the parent → `403`.
- **`customer_use` requires `email`** - at create (`400` without it) and when promoting via `PUT` (the sub-account must already have an `email`; the docs' example sets `email` and `kyc_mode` in the same PUT). Promoting a live sub-account to `customer_use` re-derives `kyc_calls_blocked` and can immediately block its calls; demoting to `personal_use` sets it `false`.
- The numeric `id` is NOT the `auth_id`. Use `auth_id` (`SA_…`) for further API calls and as `{sub_auth_id}`.
- **`auth_token` is shown once** at creation; it is `<redacted>` on every later read. Lose it → rotate from the Console (**Setup → Subaccounts → Reset Credentials / Rotate Token**; the old token stays valid for a grace window). The parent can still list/delete the sub-account without its token.
- A single **`failed`** document keeps `kyc_calls_blocked: true`. Create a new session so the customer can resubmit that document with corrected details.
- A disabled sub-account stops accepting traffic but **doesn't release its phone numbers**.
- **Unassigning a used DID is blocked for 15 days** after its last call (`409 did_cool_off_in_effect`). Plan number moves between customers around that.
- Hosted-session `expires_in_days` defaults to **7** on both the sub-account and partner endpoints. `reminder_schedule` and `metadata` are documented on the partner endpoint's contract; the sub-account walkthroughs (`sub-accounts/kyc/email-flow-webhook`) also pass them - check that page before relying on them here.

## When to search docs

- Full create → KYC → number → first call walkthrough → `sub-accounts/onboarding-flow`
- KYC overview and document matrix → `sub-accounts/kyc/overview`
- Hosted session, webhook events, signature → `sub-accounts/kyc/email-flow-webhook`, `sub-accounts/kyc/redirect-flow-webhook`
- Test mode → `sub-accounts/kyc/test-mode`
- Sub-account vs partner decision → `concepts/sub-accounts-vs-partner-accounts`
- Console management (rotate token, assign numbers) → `platform/subaccounts`
