> ## Documentation Index
> Fetch the complete documentation index at: https://developers.portao3.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Create your tax issuer

> Creates the tax issuer of the organization: the registration that lets it issue service invoices (NFSe).

The CNPJ, legal name, address and phone of the organization are taken from its registration in Portão 3 and registered with the tax provider, together with the service data you send. Two configurations are created: `nfseHomologationConfigurations` for the `TEST` (homologation) environment, where documents have no fiscal value, and `nfseProductionConfigurations` for the `LIVE` (production) environment. Each has its own RPS numbering. Then upload your digital certificate, which cities generally require to issue invoices.

When `isSimplesNacional` is `false`, the `taxConfiguration` of the live configuration is required and must carry `taxClassification` and `operationIndicatorCode`. The test configuration is not checked.

An organization has one active tax issuer: creating another answers 409. One you deactivated can be replaced by a new one.

If the tax provider rejects the request, the error is returned with the provider's error `code` and a status of 400, 409, 422 or 502.


## OpenAPI

````yaml /api-reference/accounting.openapi.json post /realms/{realmId}/organizations/{organizationId}/tax-issuer
openapi: 3.0.3
info:
  title: Accounting
  version: 1.0.0
  description: >-
    Portão 3 accounting API. Every endpoint requires a bearer token in the
    Authorization header (Authorization: Bearer <token>) unless its page states
    otherwise; see the Authentication guide. That requirement is not repeated
    per endpoint. Generated by tools/openapi from code (routes + security) and
    the hand-written spec (request/response bodies). NFSe issuance: the
    organization's tax issuer (setup, certificate, logo), its tax documents
    (issue, list, download, cancel, CSV batches) and the city special-tax-regime
    lookup. Every route validates path, query, body and multipart form through a
    zod Input class (`accounting/app/use-case/*/inputs`), which documents it;
    responses are the named interfaces in
    `accounting/app/use-case/*/outputs/*Response.ts`. Confidence tiers:
    generated:typed=24 copied:manual=0 unknown=0.
servers:
  - url: https://api.accounting.v2.portao3.com.br/
    description: production
  - url: https://api.accounting.dev.3pers.com.br/
    description: development
security: []
tags:
  - name: Tax Issuers
  - name: Tax Documents (NFSe)
  - name: Tax Codes
paths:
  /realms/{realmId}/organizations/{organizationId}/tax-issuer:
    post:
      tags:
        - Tax Issuers
      summary: Create your tax issuer
      description: >-
        Creates the tax issuer of the organization: the registration that lets
        it issue service invoices (NFSe).
      operationId: postRealmsByRealmIdOrganizationsByOrganizationIdTaxIssuer
      parameters:
        - name: realmId
          in: path
          required: true
          description: |-
            ID of your realm.

            Format: `UUID`
          schema:
            type: string
            format: uuid
          example: f495ff0c-ab54-4f99-8e92-ca8682e4de9b
        - name: organizationId
          in: path
          required: true
          description: |-
            ID of the organization.

            Format: `UUID`
          schema:
            type: string
            format: uuid
          example: c4bd3f21-dfbd-44e8-8055-68ba15bed410
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                specialTaxCode:
                  type: string
                  minLength: 1
                  maxLength: 2
                  description: >-
                    Code of the special taxation regime of the city where your
                    organization is registered: the `id` of one of the regimes
                    `GET /taxCode/{specialTaxCode}` lists for that city. One or
                    two characters.
                  example: '1'
                municipalServiceCode:
                  type: string
                  minLength: 1
                  maxLength: 4
                  description: >-
                    Municipal service code, as your city hall defines it for the
                    service you provide. Up to 4 characters. Used on every
                    invoice that does not send its own.
                  example: '0107'
                serviceListItem:
                  description: >-
                    Item of the federal service list (LC 116/2003) that
                    describes your service, such as `1.07`. Up to 8 characters.
                    Optional here, but required when you update the issuer. Used
                    on every invoice that does not send its own.
                  example: '1.07'
                  type: string
                  maxLength: 8
                cnae:
                  type: string
                  minLength: 1
                  maxLength: 10
                  description: >-
                    CNAE subclass code of your main activity. It must be an
                    existing CNAE code, otherwise the request fails with
                    `CNAE_NOT_FOUND`. Used on every invoice that does not send
                    its own.
                  example: '6201501'
                issTax:
                  type: number
                  description: >-
                    ISS (municipal service tax) rate in percent: `2.5` means
                    2.5%. Rounded to 2 decimal places. Used on every invoice
                    that does not send its own.
                  example: 2.5
                serviceDescription:
                  type: string
                  minLength: 1
                  maxLength: 1500
                  description: >-
                    Description of the service you provide. Up to 1500
                    characters.
                  example: Licenciamento de software como serviço (SaaS)
                hasCulturalIncentive:
                  type: boolean
                  description: >-
                    Whether your organization is a cultural incentivizer
                    (`incentivador cultural`).
                  example: false
                isSimplesNacional:
                  type: boolean
                  description: >-
                    Whether your organization is under the Simples Nacional tax
                    regime. When `false`, the live (production)
                    `taxConfiguration` must carry `taxClassification` and
                    `operationIndicatorCode`, otherwise the request fails with
                    `TAX_CONFIGURATION_INCOMPLETE`.
                  example: true
                nfseHomologationConfigurations:
                  type: object
                  properties:
                    nfeSequencialCode:
                      type: integer
                      description: >-
                        Number of the next RPS (provisional service receipt)
                        issued in the test environment. Integer.
                      example: 1
                    nfeSeries:
                      type: string
                      minLength: 1
                      maxLength: 5
                      description: >-
                        Series of the RPS issued in the test environment. Up to
                        5 characters.
                      example: '1'
                    nfeSequencialBatch:
                      type: integer
                      description: >-
                        Number of the next RPS batch sent in the test
                        environment. Integer.
                      example: 1
                    taxConfiguration:
                      description: >-
                        National NFSe tax fields of the LC 214/2025 reform for
                        the test environment. The rules for `isSimplesNacional`
                        `false` are checked on the live (production)
                        configuration only; send the same values here so your
                        tests are faithful.
                      type: object
                      properties:
                        nbsCode:
                          description: >-
                            NBS code (`Nomenclatura Brasileira de Serviços`) of
                            your service. Optional.
                          example: '115090000'
                          type: string
                        nationalTaxCode:
                          description: >-
                            National tax code (`código de tributação nacional`)
                            of your service. Not required to create the issuer,
                            but issuing an invoice or updating the issuer
                            requires it when `isSimplesNacional` is `false`.
                          example: '010701'
                          type: string
                        taxClassification:
                          description: >-
                            Tax classification (`classificação tributária`) of
                            the operation. Required for the live (production)
                            configuration when `isSimplesNacional` is `false`.
                          example: '000001'
                          type: string
                        operationIndicatorCode:
                          description: >-
                            Operation indicator (`indicador de operação`) code.
                            Required for the live (production) configuration
                            when `isSimplesNacional` is `false`.
                          example: '100301'
                          type: string
                      additionalProperties: false
                  required:
                    - nfeSequencialCode
                    - nfeSeries
                    - nfeSequencialBatch
                  additionalProperties: false
                  description: >-
                    Configuration of the test (homologation) environment:
                    documents issued here have no fiscal value.
                nfseProductionConfigurations:
                  type: object
                  properties:
                    nfeSequencialCode:
                      type: integer
                      minimum: 1
                      description: >-
                        Number of the next RPS (provisional service receipt)
                        issued in the live environment. Integer, at least 1:
                        send the number your city hall expects next.
                      example: 1
                    nfeSeries:
                      type: string
                      minLength: 1
                      maxLength: 5
                      pattern: ^\d+$
                      description: >-
                        Series of the RPS issued in the live environment. Digits
                        only, up to 5.
                      example: '1'
                    nfeSequencialBatch:
                      type: integer
                      description: >-
                        Number of the next RPS batch sent in the live
                        environment. Integer.
                      example: 1
                    taxConfiguration:
                      description: >-
                        National NFSe tax fields of the LC 214/2025 reform for
                        the live environment. Required when `isSimplesNacional`
                        is `false`: `taxClassification` and
                        `operationIndicatorCode` must be set, otherwise the
                        request fails with `TAX_CONFIGURATION_INCOMPLETE`.
                      type: object
                      properties:
                        nbsCode:
                          description: >-
                            NBS code (`Nomenclatura Brasileira de Serviços`) of
                            your service. Optional.
                          example: '115090000'
                          type: string
                        nationalTaxCode:
                          description: >-
                            National tax code (`código de tributação nacional`)
                            of your service. Not required to create the issuer,
                            but issuing an invoice or updating the issuer
                            requires it when `isSimplesNacional` is `false`.
                          example: '010701'
                          type: string
                        taxClassification:
                          description: >-
                            Tax classification (`classificação tributária`) of
                            the operation. Required when `isSimplesNacional` is
                            `false`.
                          example: '000001'
                          type: string
                        operationIndicatorCode:
                          description: >-
                            Operation indicator (`indicador de operação`) code.
                            Required when `isSimplesNacional` is `false`.
                          example: '100301'
                          type: string
                      additionalProperties: false
                  required:
                    - nfeSequencialCode
                    - nfeSeries
                    - nfeSequencialBatch
                  additionalProperties: false
                  description: >-
                    Configuration of the live (production) environment:
                    documents issued here are legally valid.
              required:
                - specialTaxCode
                - municipalServiceCode
                - cnae
                - issTax
                - serviceDescription
                - hasCulturalIncentive
                - isSimplesNacional
                - nfseHomologationConfigurations
                - nfseProductionConfigurations
              additionalProperties: false
      responses:
        '204':
          description: No Content. The operation succeeded and the response has no body.
        '400':
          description: >-
            `TAX_CONFIGURATION_INCOMPLETE` — `isSimplesNacional` is `false` and
            the live `taxConfiguration` is missing, or lacks `taxClassification`
            or `operationIndicatorCode`.


            `INTEGRATION_ERROR` — The tax provider registered the issuer but did
            not activate it, so it cannot be used. Fix the data and create it
            again.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - TAX_CONFIGURATION_INCOMPLETE
                      - INTEGRATION_ERROR
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - ACCOUNTING
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: TAX_CONFIGURATION_INCOMPLETE
                origin: ACCOUNTING
                message: >-
                  The fields `Tax Situation` and `Tax Classification` are
                  mandatory for issuers that are not of the `Simples Nacional`
                  type. The fields `codigoTributacaoNacional` and `codigoNBS`
                  are optional.
        '404':
          description: >-
            `CNAE_NOT_FOUND` — `cnae` is not an existing CNAE code.


            `ORGANIZATION_NOT_FOUND` — The organization does not exist in your
            realm.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - CNAE_NOT_FOUND
                      - ORGANIZATION_NOT_FOUND
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - ACCOUNTING
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: CNAE_NOT_FOUND
                origin: ACCOUNTING
                message: Cnae not found
        '409':
          description: >-
            `TAX_ISSUER_CONFLICT` — The organization already has an active tax
            issuer.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - TAX_ISSUER_CONFLICT
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - ACCOUNTING
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: TAX_ISSUER_CONFLICT
                origin: ACCOUNTING
                message: Tax issuer already exists
        '422':
          description: >-
            `BAD_REQUEST` — A path parameter is not a valid ID or the body
            failed validation; `fields` lists each offending field.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - BAD_REQUEST
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - ACCOUNTING
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                  fields:
                    type: array
                    description: >-
                      One entry per invalid request field (validation errors
                      only).
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                          description: >-
                            Path of the invalid field, e.g. `label` or
                            `values[0].value`.
                          example: label
                        message:
                          type: string
                          description: Why the field was rejected.
                          example: label is required
                        code:
                          type: string
                          description: >-
                            `<FIELD>_<REASON>` — e.g. `LABEL_REQUIRED`,
                            `TYPE_ONE_OF`, `VALUES_VALUE_TYPE_ERROR`.
                          example: LABEL_REQUIRED
                        values:
                          type: array
                          items:
                            type: string
                          description: >-
                            The accepted values, when the field is an
                            enumeration.
                      required:
                        - field
                        - message
                        - code
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: BAD_REQUEST
                origin: ACCOUNTING
                message: >-
                  Bad Request: Your request is invalid or incomplete. Please
                  make sure you are requesting with the right fields.
                fields:
                  - field: specialTaxCode
                    message: 'Invalid input: expected string, received undefined'
                    code: SPECIALTAXCODE_REQUIRED

````

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