e-invoicing

About branches

A branch is a subdivision of a storage section that identifies a tax entity in a specific country.

It is identified by three values: the section name, a country code (ISO 3166 alpha-2), and a tax identifier such as a VAT number.

Invoices and cryptographic keys are stored at the section level, not at the branch level. The branch provides a way to associate configurations that affect signing on a per-tax-entity basis. For example, a branch can have an associated cryptographic key reference, which TrustWeaver uses to select the correct signing key during corroboration when multiple keys are available in the section.

Note: The branch country code doesn't need to match the country of establishment of the storage section it belongs to.

When branches are required

Branches are required when corroboration includes clearance. This applies when the signature format requires the invoice to be submitted to a tax authority for approval. In clearance scenarios, the branch to which the invoice belongs must be identified and registered before submitting documents.

Branches are also used when individual signing keys must be selected per tax entity. Associating a cryptographic key reference with a branch allows TrustWeaver to resolve the correct key from the branch identity during a corroborate operation.

Branch identity

A branch is uniquely identified within a section by the combination of CountryCode and TaxId. The TaxId format depends on the country.

Manage branches

The admin service provides different operations for branch management. Each is a single API call to the admin service endpoint. Before using these operations, confirm that the target storage section is already registered. For more information, see Register and enable a section.

RegisterBranch operation

Creates or updates a branch within a section. The branch is identified by the combination of section name, country code, and tax identifier.

Request elements

Request type taa:RegisterBranchRequest extends tac:TrustArchiveRequest

Element Type Cardinality Description
SectionName xs:string 1 The name of the section. Maximum 80 characters.
CountryCode xs:string 1 ISO 3166 alpha-2 country code of the tax entity.
TaxId xs:string 1 Tax identifier for the entity, for example a VAT number. For Peru (PE) and Argentina (AR): exactly 11 digits. For all other countries: 1 to 250 characters.
BranchInfo taa:BranchInfo 1 Branch information. See the BranchInfo elements entry.
RegistrationMode taa:RegistrationMode 1 Controls behavior when the branch already exists. See the RegistrationMode values entry.
BrProfile taa:BrProfile Parameters specific to Brazil. This element is ignored when the CountryCode element has the value BR. Otherwise, this element must be omitted. BrProfile used to be required for Brazil but it is now deprecated.
BrFormatProfile taa:BrFormatProfile 0..1 Parameters specific to Brazil. Required for Brazilian corroborate sign operations. Must be omitted for the other countries.
KrProfile taa: KrProfile 0..1 Parameters specific to South Korea. This element requires CountryCode to be KR.
AuthorizationToken xs:string 0..1 Required when CountryCode is TR and the branch doesn't exist yet. Must be omitted otherwise. Maximum 32 characters.
BranchInfo elements
Element Type Cardinality Description
FriendlyName xs:string 0..1 A human-readable name for the branch.
CryptoKeyReference xs:string 0..1 The 32-digit hexadecimal reference to a stored cryptographic key to associate with the branch. The key can then be selected by branch identity during corroboration.
AdminEmailAddress xs:string 0..1 Email address for administrative purposes, with up to 250 characters. Required when creating a new branch and optional when updating with OverwriteInfo. Omitting this element preserves the existing value.
RegistrationMode values
CreateNew

Creates a new branch. Returns an error if a branch with the same country code and tax identifier already exists in the section.

OverwriteAndClearInfo

Same as OverwriteInfo, with the addition that any configuration not included in the request is cleared.

Request example
CODE
<RegisterBranch xmlns="http://www.trustweaver.com/trustarchive/admin/v1"
                xmlns:tac="http://www.trustweaver.com/trustarchive/common/v1">
  <Request>
    <tac:TransactionId>3580f...</tac:TransactionId>
    <SectionName>customer1</SectionName>
    <CountryCode>BR</CountryCode>
    <TaxId>[Your_TaxID]</TaxId>
    <BranchInfo>
      <FriendlyName>New Branch</FriendlyName>
      <CryptoKeyReference>5f900...</CryptoKeyReference>
      <AdminEmailAddress>example@email.com</AdminEmailAddress>
    </BranchInfo>
    <RegistrationMode>OverwriteInfo</RegistrationMode>
  </Request>
</RegisterBranch>
Response

A successful response contains no sub-elements:

CODE
<RegisterBranchResponse
  xmlns="http://www.trustweaver.com/trustarchive/admin/v1"/>
Error codes
For error codes returned by this operation, see Admin service error codes.

ListBranches operation

Returns all branches registered in a section.

Request elements

Request type taa:ListBranchesRequest extends tac:TrustArchiveRequest

Element Type Cardinality Description
SectionName xs:string 1 The name of the section. Maximum 80 characters.
Request example
CODE
<ListBranches xmlns="http://www.trustweaver.com/trustarchive/admin/v1"
              xmlns:tac="http://www.trustweaver.com/trustarchive/common/v1">
  <Request>
    <tac:TransactionId>c7e8a...</tac:TransactionId>
    <SectionName>section1</SectionName>
  </Request>
</ListBranches>
Response

Returns a BranchIdentifiers collection. Each BranchIdentifier contains the section name, country code, and tax identifier of a registered branch. The collection is empty if no branches are registered.

CODE
<ListBranchesResponse
  xmlns="http://www.trustweaver.com/trustarchive/admin/v1">
  <Result>
    <BranchIdentifiers>
      <BranchIdentifier>
        <SectionName>section1</SectionName>
        <CountryCode>BR</CountryCode>
        <TaxId>[Your_TaxID]</TaxId>
      </BranchIdentifier>
      <BranchIdentifier>
        <SectionName>section1</SectionName>
        <CountryCode>PE</CountryCode>
        <TaxId>[Your_TaxID]</TaxId>
      </BranchIdentifier>
    </BranchIdentifiers>
  </Result>
</ListBranchesResponse>
Error codes
For error codes returned by this operation, see Admin service error codes.

GetBranchInfo operation

Retrieves information about a specific branch identified by section name, country code, and tax identifier.

Request elements

Request type taa:GetBranchInfoRequest extends tac:TrustArchiveRequest

Element Type Cardinality Description
SectionName xs:string 1 The name of the section. Maximum 80 characters.
CountryCode xs:string 1 ISO 3166 alpha-2 country code of the tax entity.
TaxId xs:string 1 Tax identifier for the entity. For Peru (PE) and Argentina (AR): exactly 11 digits. For all other countries: 1 to 250 characters.
Request example
CODE
<GetBranchInfo xmlns="http://www.trustweaver.com/trustarchive/admin/v1">
  <Request>
    <tac:TransactionId>8fe5...</tac:TransactionId>
    <SectionName>section1</SectionName>
    <CountryCode>BR</CountryCode>
    <TaxId>[Your_TaxID]</TaxId>
  </Request>
</GetBranchInfo>
Response

Returns the branch identity and its associated BranchInfo. Any sensitive fields in BackendCredential are stripped from the response.

CODE
<GetBranchInfoResponse
  xmlns="http://www.trustweaver.com/trustarchive/admin/v1">
  <Result>
    <SectionName>section1</SectionName>
    <CountryCode>BR</CountryCode>
    <TaxId>[Your_TaxID]</TaxId>
    <BranchInfo>
      <FriendlyName>New Branch</FriendlyName>
      <CryptoKeyReference>ABCD1234</CryptoKeyReference>
      <AdminEmailAddress>example@email.com</AdminEmailAddress>
    </BranchInfo>
  </Result>
</GetBranchInfoResponse>
Error codes
For error codes returned by this operation, see Admin service error codes.

Country-specific branch requirements

Countries that require additional parameters or preparation steps when registering a branch:

India

Set CountryCode to IN and TaxId to the company's Goods and Services Tax Identification Number (GSTIN). The GSTIN is a 15-digit identifier assigned upon GST registration. It encodes the state code, the Permanent Account Number (PAN), a registration sequence digit, the fixed character Z, and a check digit.

Set BranchInfo.BackendCredential.UsernameTokenCredential to the GST portal credentials for the company:

Username
The username issued by the GST portal upon registration
Password
The password issued by the GST portal upon registration

These credentials are required for TrustWeaver to authenticate to the Invoice Registration Portal (IRP) on behalf of the company. BrFormatProfile must be omitted for India.

Important: The archive is separated at the section level, not the branch level. If each GSTIN must have a separate archive, register a separate section for each GSTIN, with one branch per section. For more information, see India archiving requirements.
South Korea

Set CountryCode to KR and include the KrProfile element. KrProfile contains a KrPrivateKeyContainer with two required sub-elements:

KeyData
The Base64-encoded private key in binary format, with up to 100,000 bytes
KeyPwd
A password with up to 250 characters, used to decrypt the private key
Note:

KrProfile must be omitted for all countries other than South Korea.

Turkey

Set CountryCode to TR and include AuthorizationToken when registering a new branch. AuthorizationToken is required for Turkey when the branch doesn't exist yet and you must omit it in all other cases. Maximum length is 32 characters.