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

# Prepare customer and invoice portal access

> Integration guide for Prepare customer and invoice portal access

Save a new UUID before preparing access. Choose the exact team and explicit live or
test mode. Preparation returns operation metadata and a private browser handoff;
it does not return a bearer token or customer access URL.

## Customer access

```bash theme={null}
export GIGSTACK_API_BASE="https://api.gigstack.io/v2"
# Set TEAM_ID, CLIENT_ID, GIGSTACK_TOKEN and a saved OPERATION_ID locally.
curl --fail-with-body "$GIGSTACK_API_BASE/teams/$TEAM_ID/customer-portal-operations" \
  -H "Authorization: Bearer $GIGSTACK_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"operation_id\":\"$OPERATION_ID\",\"livemode\":false,\"client_id\":\"$CLIENT_ID\"}"
```

Alternatively, supply `email` instead of `client_id`; it must resolve exactly one
current client in the selected team. The team must have its customer portal configured.
The challenge lasts five days. Exchanging it creates the existing three-day customer
session, which can read payments, receipts and invoices, update client data, download
files, render authorized PDFs and validate renewal. The renewal endpoint returns
claims; it does not mint a replacement JWT.

## Invoice access

Use `POST /teams/{id}/invoice-portal-operations` with the saved UUID, explicit
`livemode`, `scopes: ["invoices:read"]` and optional `expiresIn`, such as `"1h"`.
The default is one hour and the maximum is 24 hours. This family can list invoices
and download their stored files. Original source branding remains part of its scope.

## Review, read back and revoke

1. Read `data.browser_handoff.url` from the preparation response and open it in
   your signed-in account browser. Opening performs a read.
2. Reauthenticate and review the exact team, client, mode, lifetime and effects.
   Current MFA is required when enrolled. Explicit approval issues access once.
3. Use the private page's copy or open action. The credential remains in memory
   and appears only in the first successful private response.
4. After a timeout or lost response, use `GET /teams/{id}/customer-portal-operations/{operationId}`
   or the equivalent `invoice-portal-operations` route. Readback never replays access.
   Do not automatically retry issuance or replace it with a fresh UUID.
5. `DELETE` at the same operation path cancels an untouched preparation; it cannot
   revoke completed access. Use private reviewed revocation for a managed session.
   A reviewed replacement uses a new saved UUID and `replaces_operation_id` and
   revokes the previous generation before issuance. A failed replacement can leave
   the previous access revoked. Historical unversioned sessions are outside this guarantee.

Current customer access requires an eligible team viewer; invoice access requires
an eligible administrator. Original machine authority and the browser reviewer are
checked independently. API-key creator identity never supplies human approval.
Current grant, team, account, mode, expiry and managed generation are rechecked by
consumers. Revoked or expired requesting credentials do not prevent an independently
eligible current browser user from reviewing managed revocation.

MCP provides `prepare_customer_portal_access`, `get_customer_portal_operation`,
`cancel_customer_portal_preparation`, `prepare_invoice_portal_access`,
`get_invoice_portal_operation` and `cancel_invoice_portal_preparation`.
CLI provides `portal-access customer|invoices prepare|get|cancel`. Both expose safe
metadata only. CLI's `--expected-mode live|test` is an assertion; the server checks
actual authority independently. Private review and issuance are browser actions.
The old raw API issuers return `410`; the old MCP issuer is unregistered and the
CLI alias explains this migration without issuing an HTTP request.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.