● Travel Never Stops. Neither Do We. 365 Days a Year.

B2B API Design for Agency Branch Access

Design branch-level access for a travel agency B2B API. Model partner organizations, booking branches, service accounts and staff permissions.

Two travel agency colleagues stand beside separate shelves of colored booking folders

A travel agency may have one commercial agreement, twelve offices, several booking teams, and a central finance department. One shared agency identifier seems convenient until a branch exposes another office's bookings, headquarters changes a reservation, or support loses actor attribution. A reliable b2b api makes those boundaries explicit before it exposes search, booking, servicing, and reporting endpoints.

The useful starting question is not simply whether a caller belongs to an agency. It is which organization owns the commercial relationship, which branch is accountable for a particular transaction, and which human or system is performing this action now. These are different facts. Conflating them produces ambiguous permissions and unreliable audits.

This guide describes a practical authorization model for agency-facing travel software. It uses OAuth terminology where helpful, but it does not claim that a protocol standard supplies the branch hierarchy or determines a travel company's operating policy. Examples describe hypothetical choices, not live provider capabilities.

Three Distinct Identities

Partner Organization

A partner organization represents the agency business recognized by the platform. It may hold commercial terms, settlement arrangements, credit limits, enabled products, contractual contacts, and policies for managing offices. Call it partner_id. The partner is often the top-level tenant boundary, but tenancy alone is insufficient when users and automation must operate within specific offices.

Commercial ownership does not make every employee a universal operator. A contract negotiated at headquarters may apply to several branches while tickets, markups, local approvals, and customer relationships remain branch-specific. Model those inherited terms separately from transaction authority. Headquarters discounts need not authorize ticket cancellation.

Booking Branch

A booking branch represents the office or operational unit accountable for bookings. Give it an immutable branch_id linked to one partner. Assign a booking to its owning branch at creation and preserve that attribution in orders, documents, refunds, and financial events. Stable identifiers preserve history when office names and hierarchies change.

A branch is not necessarily a physical storefront. An online sales team, corporate travel desk, franchise division, or regional servicing unit may need its own boundary. Specify whether ownership governs visibility, changes, markups, or payments. Do not assume that geographic location determines entitlement: staff can work remotely and bookings may originate through shared digital channels.

Actor Identity

An actor is the authenticated human or service principal performing an operation. A travel consultant may have membership in two branches; a manager may inspect reports for four; an overnight reconciliation process may have no human session. Store a stable actor_id and an actor type, then connect that identity to approved roles and branch memberships. Avoid sharing a single login among an entire office.

These three objects answer different questions: partner, whose business relationship applies; branch, whose transaction or operating area is affected; actor, who initiated the action. Also distinguish the OAuth client application from the actor. A browser frontend or agency middleware may identify the software requesting a token, while the signed-in consultant remains the accountable human. Client credentials cannot prove human approval.

Permissions and Resources

Combine Authority and Ownership

Authorization should evaluate more than a role string. A useful decision combines the requested capability, the target resource, the actor's memberships or service grants, the partner boundary, and relevant conditions. For example, bookings:cancel describes an operation but says nothing about which booking may be cancelled. The resource's stored branch_id provides the missing context.

For a branch consultant, require an active membership in the booking's owning branch and a role that permits cancellation, subject to fare rules and workflow status. For a newly created booking, require permission to create under the requested branch before accepting any passenger or payment details. For a support operator, require a separate support grant rather than borrowing the consultant's role.

Use server-side resource lookup to enforce ownership. A supplied branch_id should select the intended context, not grant access to it. Likewise, a URL such as /branches/BR-2/bookings/BK-91 does not prove that booking BK-91 belongs to BR-2. Fetch the actual booking, verify its partner and branch relationships, and authorize against the canonical record.

Consider creation, reading, modification, ticket issuance, cancellation, refund approval, and export as separate capabilities. Some agencies allow consultants to create and service bookings but require local supervisors for refunds. Others centralize ticketing. Explicit capabilities support those differences without hard-coding assumptions about every agency's hierarchy into endpoint behavior.

Headquarters Reporting

Headquarters needs consolidated visibility for sales totals, liabilities, commissions, supplier performance, and branch comparisons. That is an aggregation privilege, not automatically a right to mutate every branch's bookings. A permission such as reports:read:partner may cover authorized partner-wide summaries, while bookings:update:branch remains constrained by specific memberships.

Even read access requires boundaries. A headquarters finance analyst might view settlement totals and booking references but not full passport details or traveler contact information. Design field-level responses or purpose-specific report datasets, rather than granting a powerful booking-read permission merely to build a dashboard. For drill-down views, decide explicitly which personal fields and documents each role may access.

Cross-branch reports should use the partner's authorized branch set and a consistent snapshot of relevant financial events. A row's originating branch must remain visible so reconciliation is explainable. If an office moves to another reporting group, historical totals should not silently change without an effective-date or restatement policy. Separate organizational reporting relationships from booking ownership.

Authorization Data Model

A clear schema reduces accidental privilege escalation. At minimum, maintain partners, branches, actors, memberships, roles or capabilities, client applications, service grants, and resource ownership. A membership connects an actor to a branch with a validity period and assigned capabilities. A partner-level role is a distinct grant, not a synthetic membership in every branch. This distinction matters when a new branch opens.

Represent service principals as real identities with their own grants and credential lifecycle. Record which partner sponsors an integration and which branches its workload can touch. An automation account assigned to one branch should not gain access to all branches just because its application was provisioned by headquarters. Conversely, a finance export workload may legitimately read multiple branches without gaining booking-write privileges.

The following matrix is an illustrative policy, not a universal travel industry rule. It deliberately separates viewing a partner-wide report, creating a booking, and changing an existing transaction. Production policies may require additional approval stages, legal controls, or product-specific limitations.

Illustrative agency access matrix
Principal Granted context Permitted example Outside grant
Branch consultant Assigned branch Create and service branch bookings Other-branch passenger records
Branch supervisor Assigned branch Approve local refunds All-partner refunds
Headquarters analyst Partner reporting view Read aggregate settlements Booking cancellation
Reconciliation service Explicitly granted branches Read financial events Ticket issuance
Support operator Time-limited case-specific grant Inspect case evidence Unrestricted consultant access
Three sets of keys and appointment cards are laid out separately as a hand adds a clip to one card

Store authorization relationships in authoritative systems, rather than relying exclusively on long-lived token claims. Tokens can carry useful identifiers and scope hints, but branch membership can be revoked, a consultant can transfer offices, and a support grant can expire. Decide how quickly changes must take effect and use appropriately short token lifetimes, fresh policy checks, revocation mechanisms, or a combination.

OAuth and Agency Boundaries

Token Identity Versus Authority

OAuth provides a language for clients, access tokens, scopes, resource servers, and delegated access. The JWT Profile for OAuth 2.0 Access Tokens, RFC 9068, describes a format for access tokens containing claims such as issuer, audience, subject, client identifier, and scope. It also discusses roles, groups, and entitlements. It does not prescribe a travel-agency branch model or standardized partner_id and branch_id claims.

If a deployment uses JWT access tokens, validate their signature, issuer, intended audience, expiration, and other applicable profile requirements before processing a request. Then evaluate the platform's own authorization rules. An otherwise valid token for one service should not be accepted by a different API simply because it contains an attractive role or branch identifier. Identity validation and business permission checks are both necessary.

A custom branch claim can be helpful when it represents an explicit, currently authorized selection. However, a single branch_id token claim is awkward for a user who can select several offices. An alternative is to carry a stable actor identifier and retrieve memberships at authorization time, or issue a narrowly scoped token for a selected branch. Document the trade-offs around latency, revocation, cache staleness, and token size.

Delegation and Token Exchange

The OAuth 2.0 Token Exchange specification, RFC 8693, supplies terminology for delegation and impersonation and defines a way to request a token suitable for another context. Its act claim can identify a current acting party in a delegation relationship. That is useful vocabulary for a system making downstream calls on behalf of an agency user; the RFC does not itself authorize support access or branch switching.

For example, an agency portal might call a booking orchestration service that then contacts an internal document service. If token exchange is supported and justified, the downstream token can be limited to the specific audience and capability needed. Keep the original subject and acting service distinguishable according to the chosen delegation semantics. A generic downstream service token that erases the initiator makes customer support and audit investigation harder.

The act claim is not a convenient place to invent arbitrary permissions. In RFC 8693 it identifies acting parties; authority still depends on top-level token information, the current actor, and the resource server's policy. Earlier nested actors describe delegation history, not additional permissions. For systems that do not implement token exchange, equivalent operational attribution can be recorded in authenticated request context and tamper-resistant audit events.

Hypothetical Agency Example

Imagine Meridian Routes, a completely hypothetical agency partner identified as P-100. It operates an Ahmedabad branch BR-A, a Bengaluru branch BR-B, and a headquarters reporting unit. Consultant Leena belongs to Ahmedabad, supervisor Farah belongs to Bengaluru, and analyst Vikram works at headquarters. A nightly settlement service, SVC-SETTLE, reconciles authorized financial events for both branches.

Leena signs in using an individual account and selects Ahmedabad in the portal. The application requests access appropriate to booking work, and the API confirms her active branch membership and booking-create capability. She creates BK-7001, which the server records with partner_id=P-100, branch_id=BR-A, created_by=Leena, and the authenticated client identifier. The browser's selected branch is input; the server's authorization decision makes it valid.

Leena subsequently retrieves BK-7001 to add an eligible ancillary item. The API checks the booking's stored branch, her current membership, and the action's allowed workflow state. If she changes the request path or body to say BR-B, the server does not reassign ownership or disclose Bengaluru bookings. It rejects an unauthorized cross-branch request without leaking details about the inaccessible record.

Farah, the Bengaluru supervisor, can approve an eligible refund for a Bengaluru booking, but she cannot approve the refund for BK-7001 merely because her role is called supervisor. If Meridian Routes wants regional supervisors, it can assign an explicit set of branches. That grant remains separate from headquarters reporting and should be visible to the agency administrator who approved it.

Vikram requests a monthly report covering both branches. The API authorizes reports:read:partner for P-100 and returns permitted totals grouped by branch. It may include booking counts, gross sales, refunds, and unsettled balances while excluding sensitive traveler fields. Vikram cannot send a booking cancellation using the report token or his reporting role. Read aggregation does not silently become write access.

At night, SVC-SETTLE uses its own non-human identity. Its grant allows financial-event reads for BR-A and BR-B, with no permission to create reservations. Every export event identifies the service principal, sponsoring partner, dataset, branch coverage, and execution identifier. The audit record should not invent a human approver for an unattended run; the configuration approver is a separate fact.

Now a traveler calls support about BK-7001. A TravelTech365-style support workflow could assign a fictional operator, Maya, to a verified case. A case-specific grant authorizes her to inspect permitted booking evidence for a limited period. If a workflow allows her to perform an amendment on behalf of Leena or Meridian Routes, the system records who actually acted, the authority used, the customer-facing context, and the before-and-after change.

This sequence makes a crucial distinction visible: the partner stays P-100, the booking remains owned by BR-A, but different actors may legitimately touch related records for different purposes. Changing the acting party does not move the booking, and obtaining a broader report view does not confer a broader servicing role.

Support and Attribution

Constrain Exceptional Access

Support teams need enough visibility to resolve supplier errors, payment discrepancies, document issues, and traveler inquiries. They do not need permanent unrestricted access to every agency tenant. Create a dedicated support path with verified case reference, reason, approved capabilities, target partner and resource, approving authority where required, and a short validity window. Policies should distinguish viewing evidence from modifying customer data.

Do not ask support personnel to log in using an agency employee's password or reuse that employee's bearer token. Those shortcuts make audit records falsely attribute actions to the customer, increase credential exposure, and blur responsibility. An assisted action should identify the authenticated support operator as the performer, even when the business intent comes from an authorized agency representative.

Record meaningful transitions: who opened the case, what identity was verified, which grant was issued, which booking was viewed, which fields changed, whether an approval was obtained, and when access ended. Protect audit records from ordinary users editing their own history. Avoid copying full documents, secrets, or payment details into logs; references, redacted field changes, and controlled evidence stores are generally more useful.

Attribution Versus Authorization

An audit event should answer who performed an action and under what authority. An authorization decision should answer whether that action is permitted now. Historical evidence cannot replace live entitlement checks. Likewise, a claim saying an actor previously served a customer cannot by itself justify a new operation. Store grant identifiers and decision outcomes so investigators can reconstruct why access was allowed at that moment.

For asynchronous tasks, preserve the initiating human where relevant without pretending that person executed every later step. A booking consultant may submit a ticketing job; a service user later performs the supplier call. The event trail can connect the submitted instruction, service execution, authorization policy, and final result. Retries should retain correlation identifiers while producing distinct attempts and outcomes.

Endpoint and Data Boundaries

Consistent API design makes branch controls easier to test. A creation endpoint such as POST /partners/P-100/branches/BR-A/bookings expresses requested ownership, but the server must validate it. A detail endpoint can use an opaque booking identifier while deriving ownership from storage. Either pattern can work if every handler uses the same centralized authorization rules and never trusts client-provided ownership fields as proof.

Make server-side query filtering the default for list and search endpoints. First calculate the actor's allowed branch set, then filter the underlying query using that set and the partner boundary. Filtering a complete result in application code after fetching it risks side-channel leakage through totals, pagination, timing, exports, or accidental debug logging. Counts, facets, and CSV downloads must observe the same constraints.

Separate access to inventory search from access to traveler and booking records. Public or broadly available fare shopping may have different risk and quota rules than private agency rates, booking history, invoices, and passenger data. Even where an actor can search across markets, it does not follow that the actor may issue a ticket under any branch or consume another office's credit line.

For mutations, use an idempotency mechanism where repeated requests could otherwise create duplicate bookings, charges, or refunds. Bind an idempotency record to the authenticated context, operation, and appropriate branch or resource; do not let a key created in one branch authorize a replay in another. Validate resource version and workflow state when concurrent operators might act on the same transaction.

Be deliberate about transfers. If an agency genuinely moves a booking from one branch to another, represent it as an approved business operation with old owner, new owner, actor, reason, and effective time. Do not allow an arbitrary update to branch_id as a side effect of editing traveler details. Define whether linked invoices, refunds, commissions, and reporting attribution follow the transfer or retain historical ownership.

Apply rate limits and operational monitoring with suitable dimensions: client application, partner, branch, actor, and endpoint class. A single partner-wide limit can let one noisy office exhaust capacity for all others, while branch-only limits may fail to constrain a shared integration. No one allocation strategy fits every agency; measure actual workloads and expose clear throttling behavior without disclosing other branches' traffic.

Testing the Boundaries

Test Denied Actions

Start with representative principals: branch consultant, multi-branch supervisor, headquarters analyst, service user, agency administrator, and temporary support operator. For each, test permitted and prohibited operations on resources within the same branch, another branch of the same partner, and a different partner. Include expired membership, removed role, suspended partner, deactivated service credential, and changed booking ownership.

Test both direct object access and indirect disclosure. A user denied GET /bookings/BK-7001 must not obtain its details through global search, document download, refund lookup, autocomplete, reporting export, or a predictable attachment URL. Error messages should not reveal whether an unauthorized booking exists. Audit and monitoring pipelines also need controls, because they can become an unintended alternative source of sensitive records.

Exercise asynchronous and multi-step workflows. Check a consultant whose permission is withdrawn after submitting a job, a service grant that expires during processing, a booking reassigned while a refund is pending, and a headquarters analyst who attempts a write operation. Decide explicitly whether each step reauthorizes, remains bound to an earlier approved instruction, or needs fresh approval, then test that stated policy.

Include token validation failures: wrong issuer, wrong audience, expired token, unsuitable client, altered signature, and a token carrying plausible but unauthorized branch claims. Test policy-cache invalidation after access changes. If token exchange is deployed, verify that downstream tokens cannot grow the originating authority and that delegation history is interpreted consistently. Where it is not deployed, confirm that internal service identity and audit correlation still work.

Phased Release

A controlled rollout begins with read-only branch endpoints and reliable audit events, then introduces booking creation, servicing, refunds, reporting aggregation, and support escalation as separately tested capabilities. Migrate existing accounts carefully: a legacy agency-wide API key should not be silently treated as permission for every new branch. Map its actual use, assign an explicit service identity, restrict scope, and coordinate credential rotation.

Offer agency administrators a readable access review: which people can operate in each branch, which services can read financial data, who can view partner-wide reports, and which temporary grants remain active. Provide revocation and expiry controls with predictable effects. If permissions depend on product contracts, supplier configuration, or credit policies, show those as separate constraints rather than burying them inside an unexplained authorization failure.

Implementation Checklist

Before expanding a b2b api, make sure every booking and related financial event has a stable partner and owning-branch reference. Ensure actors are individually identifiable, service users have dedicated credentials, and memberships are explicit. Define operations as capabilities, attach them to the correct scope, and check authorization against stored resource relationships on every sensitive endpoint.

Review headquarters use cases independently. Consolidated reporting should specify branch coverage, data freshness, field minimization, historical attribution, and export permissions. Branch servicing should specify which transactions may be changed and when additional approval applies. Support should rely on verified cases and temporary grants, with clear distinctions among the customer, the support operator, and any downstream service that completes the work.

Finally, treat RFC terminology as a shared language for security design, not as a substitute for agency-specific decisions. Document token and claim choices, revocation timing, cross-branch exceptions, transfer procedures, and audit retention alongside functional API contracts. With those boundaries made explicit, an agency can grow from one office to many without turning every new branch, service account, or support request into a new access-control exception.