Documentation
Browse documentation

Account tax regime

Inspect account-specific tax-regime configuration and compliance state.
View as Markdown

The Account Tax Regime resource exposes mutable configuration and compliance state for one account. This is separate from the public Tax Regime catalog, which describes supported taxes and rules, and from the immutable tax-regime state attached to an issued Invoice.

The key field discriminates the response shape. A Spanish account includes an es object; a Global account omits regime-specific details until Global has account-level configuration to expose.

For Live Spanish accounts, es.submission reports the active method (direct or represented), its ready state and the direct certificate's expiry date. No credential material is exposed. es.pending_submission reports the replacement's kind, verification status, error_code, last_checked_at and certificate expiry. The active method remains unchanged until the replacement passes verification. After activation or cancellation, pending_submission becomes null.

es.representation reports the AEAT IZ860 registered-power state when represented submission is active. It is null for direct submission. All submission and representation fields are null for Test accounts, which use the simulator without AEAT credentials.

Live issuance checks submission readiness at the operation boundary.

Configure AEAT submission

These operations live under /v1/account/tax-regime/es and require a Live Spanish account's API key. Read the setup using GET /v1/account/tax-regime. Upload a .p12 or .pfx file as multipart/form-data, with certificate_file and the optional certificate_password. The maximum file size is 128 KiB. The certificate must identify the account's issuer NIF and include its private key. FiscalRail stores the credential encrypted and discards the password after parsing.

An upload returns 202 Accepted and starts verification with AEAT. Poll this resource to observe the pending result. A failed or unavailable check retains the pending certificate; retry verification or cancel the pending change. A new upload replaces the pending change. A working active setup is preserved throughout verification. Invalid uploads leave existing configurations untouched.

To use FiscalRail's representative certificate, grant the AEAT power first, then request representation verification. When direct submission is active, this stages a represented replacement and only switches after successful verification.

For an active configuration, status describes submission verification and error_code reports the latest failure. Always use ready for issuance readiness: a previously verified configuration stays usable during an unavailable recheck.

These new operations currently use HTTP directly; SDK convenience methods are not yet available. Use a Live key in the examples below.

Upload an issuer certificate

POST/v1/account/tax-regime/es/certificate

Uploads a PKCS#12 certificate and queues AEAT verification. Only Live Spanish accounts are supported. A working setup remains active until verification succeeds. A new upload replaces any pending change.

Request body
certificate_file string required
A .p12 or .pfx file, at most 128 KiB. Must include the private key and identify the account issuer NIF.
certificate_password string
PKCS#12 password. Omit for an unprotected bundle. Discarded after parsing.
Example request
curl --request POST \
  'https://api.fiscalrail.com/v1/account/tax-regime/es/certificate' \
  --header "Authorization: Bearer fra_live_..." \
  --form 'certificate_file=@issuer.p12' \
  --form-string 'certificate_password=YOUR_CERTIFICATE_PASSWORD'
Example response — 202
{
  "object": "account_tax_regime",
  "account": "acct_14Vxtqg7NhKs3Rb9CmY2Pd",
  "key": "global"
}

Verify AEAT representation

POST/v1/account/tax-regime/es/representation/verify

Queues verification of FiscalRail representation for a Live Spanish account. If direct submission is active, it remains active until the represented replacement verifies. Any pending change is replaced.

Example request
curl --request POST \
  'https://api.fiscalrail.com/v1/account/tax-regime/es/representation/verify' \
  --header "Authorization: Bearer fra_live_..."
Example response — 202
{
  "object": "account_tax_regime",
  "account": "acct_14Vxtqg7NhKs3Rb9CmY2Pd",
  "key": "global"
}

Retry submission verification

POST/v1/account/tax-regime/es/submission/verify

Queues another check of the pending configuration, or the active configuration if there is no pending change. Only Live Spanish accounts are supported.

Example request
curl --request POST \
  'https://api.fiscalrail.com/v1/account/tax-regime/es/submission/verify' \
  --header "Authorization: Bearer fra_live_..."
Example response — 202
{
  "object": "account_tax_regime",
  "account": "acct_14Vxtqg7NhKs3Rb9CmY2Pd",
  "key": "global"
}

Cancel a pending submission change

DELETE/v1/account/tax-regime/es/submission/pending

Deletes the pending change and its stored certificate, preserving the active setup. Succeeds even when there is no pending change. Only Live Spanish accounts are supported.

Example request
curl --request DELETE \
  'https://api.fiscalrail.com/v1/account/tax-regime/es/submission/pending' \
  --header "Authorization: Bearer fra_live_..."
Example response — 200
{
  "object": "account_tax_regime",
  "account": "acct_14Vxtqg7NhKs3Rb9CmY2Pd",
  "key": "global"
}

The Account Tax Regime object

The response is one of the following concrete shapes, selected by key.

Global Account Tax Regime

Properties
object string
String identifying this as an Account Tax Regime object. Always account_tax_regime.
account string
Opaque identifier for an account.
key string
Identifies the Global tax regime. Always global.
Global Account Tax Regime
{
  "object": "account_tax_regime",
  "account": "acct_14Vxtqg7NhKs3Rb9CmY2Pd",
  "key": "global"
}

Spanish Account Tax Regime

Properties
object string
String identifying this as an Account Tax Regime object. Always account_tax_regime.
account string
Opaque identifier for an account.
key string
Identifies the Spanish tax regime. Always es.
es object
Spanish account-specific configuration and compliance state.
Show child propertiesHide child properties
pending_submission object or null
Replacement being verified. Null when absent, after activation or cancellation, and for Test accounts. Failed checks retain the replacement for retry.
Show child propertiesHide child properties
kind enum
Submission method requested by the pending replacement.
Possible values
direct
represented
status enum
Latest submission verification status. A ready active configuration stays verified during a recheck; use ready to decide whether issuance is permitted.
Possible values
not_started
pending_verification
verified
invalid
unavailable
error_code string or null
Machine-readable reason for the latest failed check, such as unauthorized, unavailable, expired, nif_mismatch, not_yet_valid or duplicate_nif. Null before a check or after success.
last_checked_at string or null
When the latest verification attempt finished.
certificate_expires_at string or null
Expiry of the pending direct certificate, or null for represented submission.
submission object or null
Active AEAT submission method and readiness, or null for a Test account.
Show child propertiesHide child properties
kind enum
Submit using the issuer's uploaded certificate or FiscalRail's authorized representative certificate.
Possible values
direct
represented
ready boolean
Whether the active configuration permits live invoice issuance and submission.
status enum
Latest submission verification status. A ready active configuration stays verified during a recheck; use ready to decide whether issuance is permitted.
Possible values
not_started
pending_verification
verified
invalid
unavailable
error_code string or null
Machine-readable reason for the latest failed check, such as unauthorized, unavailable, expired, nif_mismatch, not_yet_valid or duplicate_nif. Null before a check or after success.
last_checked_at string or null
When the latest verification attempt finished.
certificate_expires_at string or null
Expiry of the issuer's certificate for direct submission; null for represented submission.
representation object or null
Current AEAT representation state, or null for a Test account or direct submission.
Show child propertiesHide child properties
kind string
Representation method used for the account. Always aeat_registered_power.
power_code string
AEAT power for submitting and consulting invoice-registration records through web services. Always IZ860.
status enum
Current result of FiscalRail's live AEAT representation check.
Possible values
not_started Verification has not been requested.
pending_verification A live verification check is queued or running.
verified The latest live check confirmed the registered power.
revoked A previously verified power failed the latest live check.
invalid No successful live check has confirmed the registered power.
verified_at string or null
When the power was last successfully verified, or null when never verified.
last_checked_at string or null
When the latest live verification attempt finished, or null before the first completed check.
Spanish Account Tax Regime
{
  "object": "account_tax_regime",
  "account": "acct_14Vxtqg2nwvPR75TpsGH8N",
  "key": "es",
  "es": {
    "submission": {
      "kind": "represented",
      "ready": true,
      "status": "verified",
      "error_code": null,
      "last_checked_at": "2026-08-25T14:30:00Z",
      "certificate_expires_at": null
    },
    "pending_submission": null,
    "representation": {
      "kind": "aeat_registered_power",
      "power_code": "IZ860",
      "status": "verified",
      "verified_at": "2026-08-25T14:30:00Z",
      "last_checked_at": "2026-08-25T14:30:00Z"
    }
  }
}

Retrieve the account tax regime

GET/v1/account/tax-regime

Returns the selected account's regime configuration and compliance state.

Responses

200 An Account Tax Regime object. JSON

Example request
import os

from fiscalrail import FiscalRail

client = FiscalRail(os.environ["FISCALRAIL_API_KEY"])

tax_regime = client.account_tax_regimes.retrieve()
Example response — 200
{
  "object": "account_tax_regime",
  "account": "acct_14Vxtqg2nwvPR75TpsGH8N",
  "key": "es",
  "es": {
    "submission": {
      "kind": "represented",
      "ready": true,
      "status": "verified",
      "error_code": null,
      "last_checked_at": "2026-08-25T14:30:00Z",
      "certificate_expires_at": null
    },
    "pending_submission": null,
    "representation": {
      "kind": "aeat_registered_power",
      "power_code": "IZ860",
      "status": "verified",
      "verified_at": "2026-08-25T14:30:00Z",
      "last_checked_at": "2026-08-25T14:30:00Z"
    }
  }
}