2.0info: 5.6.0 sefaz_gateway description: sefaz_gateway x-senior-domain: edocsx_nfe x-senior-domain-path: edocsx_nfe x-senior-service-path: sefaz_gateway contact: name: Senior X Platform url: https://dev.senior.com.br email: seniorx-dev@senior.com.brhost: platform.senior.com.br /t/senior.com.br/bridge/1.0/rest/edocsx_nfesecurityDefinitions: APIKeyHeader: type: apiKey in: header name: Authorizationsecurity: – APIKeyHeader: [] – application/json – application/jsonpaths: /sefaz_gateway/queries/healthcheck: post: description: Query para o SRE verificar a disponibilidade do serviço tags: – Queries x-senior-visibility: PRIVATE parameters: – name: input in: body required: true schema: type: object responses: 200: description: Ok schema: type: object required: – status – checks properties: status: type: string allOf: – #/definitions/upDown description: Status geral do serviço checks: type: array items: type: object allOf: – #/definitions/checkData minimum: 1 description: Verificações para assegurar o status 401: description: Invalid Credentials default: description: Error response schema: #/definitions/genericError get: description: Query para o SRE verificar a disponibilidade do serviço tags: – Queries x-senior-visibility: PRIVATE parameters: responses: 200: description: Ok schema: type: object required: – status – checks properties: status: type: string allOf: – #/definitions/upDown description: Status geral do serviço checks: type: array items: type: object allOf: – #/definitions/checkData minimum: 1 description: Verificações para assegurar o status 401: description: Invalid Credentials default: description: Error response schema: #/definitions/genericError /sefaz_gateway/queries/getUrlById: post: description: Retorna uma URL pelo ID tags: – Queries x-senior-visibility: PRIVATE parameters: – name: input in: body required: true schema: type: object required: – id properties: id: type: string maxLength: 255 description: Identificação unica do registro responses: 200: description: Ok schema: type: object allOf: – #/definitions/urlShared 401: description: Invalid Credentials default: description: Error response schema: #/definitions/genericError get: description: Retorna uma URL pelo ID tags: – Queries x-senior-visibility: PRIVATE parameters: – name: id description: Identificação unica do registro in: query required: true type: string maxLength: 255 responses: 200: description: Ok schema: type: object allOf: – #/definitions/urlShared 401: description: Invalid Credentials default: description: Error response schema: #/definitions/genericError /sefaz_gateway/queries/getAllUrls: post: description: Obter todas as URLs cadastradas tags: – Queries x-senior-visibility: PRIVATE responses: 200: description: Ok schema: type: object required: – urls properties: urls: type: array items: type: object allOf: – #/definitions/urlShared minimum: 1 description: URLs 401: description: Invalid Credentials default: description: Error response schema: #/definitions/genericError get: description: Obter todas as URLs cadastradas tags: – Queries x-senior-visibility: PRIVATE responses: 200: description: Ok schema: type: object required: – urls properties: urls: type: array items: type: object allOf: – #/definitions/urlShared minimum: 1 description: URLs 401: description: Invalid Credentials default: description: Error response schema: #/definitions/genericError /sefaz_gateway/queries/getMetadata: post: description: Default getMetadata query. Every service must handle this command and return metadata in the format requested. tags: – Queries x-senior-visibility: PRIVATE parameters: – name: input in: body required: true schema: type: object properties: metadataFormat: type: string description: responses: 200: description: Ok schema: type: object required: – metadata properties: metadata: type: string description: 401: description: Invalid Credentials default: description: Error response schema: #/definitions/genericError get: description: Default getMetadata query. Every service must handle this command and return metadata in the format requested. tags: – Queries x-senior-visibility: PRIVATE parameters: – name: metadataFormat description: in: query type: string responses: 200: description: Ok schema: type: object required: – metadata properties: metadata: type: string description: 401: description: Invalid Credentials default: description: Error response schema: #/definitions/genericError /sefaz_gateway/queries/getDependencies: post: description: Returns a list with all dependencies from this service, along with their respective versions tags: – Queries x-senior-visibility: PRIVATE responses: 200: description: Ok schema: type: object required: – dependencies properties: dependencies: type: array items: type: object allOf: – #/definitions/dependency minimum: 1 description: List with this service dependencies 401: description: Invalid Credentials default: description: Error response schema: #/definitions/genericError get: description: Returns a list with all dependencies from this service, along with their respective versions tags: – Queries x-senior-visibility: PRIVATE responses: 200: description: Ok schema: type: object required: – dependencies properties: dependencies: type: array items: type: object allOf: – #/definitions/dependency minimum: 1 description: List with this service dependencies 401: description: Invalid Credentials default: description: Error response schema: #/definitions/genericError /sefaz_gateway/actions/createUrl: post: description: Realiza o cadastro de uma nova URL tags: – Actions x-senior-visibility: PRIVATE parameters: – name: input in: body required: true schema: type: object allOf: – #/definitions/createUrlRecord responses: 200: description: Ok schema: type: object allOf: – #/definitions/urlShared 401: description: Invalid Credentials default: description: Error response schema: #/definitions/genericError /sefaz_gateway/actions/updateUrl: post: description: Atualiza uma URL tags: – Actions x-senior-visibility: PRIVATE parameters: – name: input in: body required: true schema: type: object allOf: – #/definitions/updateUrlRecord responses: 200: description: Ok schema: type: object allOf: – #/definitions/urlShared 401: description: Invalid Credentials default: description: Error response schema: #/definitions/genericError /sefaz_gateway/actions/deleteUrl: post: description: Deleta uma URL tags: – Actions x-senior-visibility: PRIVATE parameters: – name: input in: body required: true schema: type: object required: – id properties: id: type: string maxLength: 255 description: Identificação unica do registro responses: 200: description: Ok schema: type: object 401: description: Invalid Credentials default: description: Error response schema: #/definitions/genericError /sefaz_gateway/actions/invoiceStatusProtocolSync: post: description: Consulta a situação de uma NFe via protocolo na SEFAZ de forma síncrona tags: – Actions x-senior-visibility: PRIVATE parameters: – name: input in: body required: true schema: type: object required: – invoiceStatusProtocol properties: invoiceStatusProtocol: type: object allOf: – #/definitions/invoiceStatusProtocolRecord description: Dados da NFe responses: 200: description: Ok schema: type: object required: – invoiceStatusResponse properties: invoiceStatusResponse: type: object allOf: – #/definitions/invoiceStatusResponseRecord description: Retorno da SEFAZ 401: description: Invalid Credentials default: description: Error response schema: #/definitions/genericError /sefaz_gateway/actions/statusService: post: description: Consulta status do serviço na SEFAZ tags: – Actions x-senior-visibility: PRIVATE parameters: – name: input in: body required: true schema: type: object required: – statusService properties: statusService: type: object allOf: – #/definitions/statusServiceRecord description: Payload responses: 200: description: Ok schema: type: object required: – status properties: status: type: object allOf: – #/definitions/statusServiceResponseRecord description: Status do serviço 401: description: Invalid Credentials default: description: Error response schema: #/definitions/genericError /sefaz_gateway/signals/invoiceStatus: post: description: Consulta a situação de uma NFe na SEFAZ tags: – Signals parameters: – name: input in: body required: true schema: type: object required: – invoiceStatus properties: invoiceStatus: type: object allOf: – #/definitions/invoiceStatusRecord description: Dados da NFe responses: 202: description: Accepted default: description: Error response schema: #/definitions/genericError /sefaz_gateway/signals/invoiceStatusProtocol: post: description: Consulta a situação de uma NFe via protocolo na SEFAZ de forma assíncrona tags: – Signals parameters: – name: input in: body required: true schema: type: object required: – invoiceStatusProtocol properties: invoiceStatusProtocol: type: object allOf: – #/definitions/invoiceStatusProtocolRecord description: Dados da NFe responses: 202: description: Accepted default: description: Error response schema: #/definitions/genericError /sefaz_gateway/signals/dfeDistributionRequest: post: description: Consulta os NSUs de distribuição de NF-e tags: – Signals parameters: – name: input in: body required: true schema: type: object required: – dfeDistributionRequest properties: dfeDistributionRequest: type: object allOf: – #/definitions/dfeDistributionRequestRecord description: Dados para consulta responses: 202: description: Accepted default: description: Error response schema: #/definitions/genericError /sefaz_gateway/events/urlChanged: post: description: Notifica a alteração/criação de uma URL x-senior-event: true tags: – Events parameters: – name: input in: body required: true schema: type: object required: – documentType – environmentChanged properties: documentType: type: string allOf: – #/definitions/documentType description: Tipo do documento environmentChanged: type: string allOf: – #/definitions/environmentType description: Tipo de ambiente responses: 200: description: OK default: description: Error response schema: #/definitions/genericError /sefaz_gateway/events/outgoingInvoiceSentResult: post: description: Notifica o resultado da consulta de status de uma NFe x-senior-event: true tags: – Events parameters: – name: input in: body required: true schema: type: object required: – invoiceStatus properties: invoiceStatus: type: object allOf: – #/definitions/invoiceStatusResponseRecord description: Retorno da SEFAZ responses: 200: description: OK default: description: Error response schema: #/definitions/genericError /sefaz_gateway/events/eventReceptionResponse: post: description: Notifica a resposta do evento de uma NFe x-senior-event: true tags: – Events parameters: – name: input in: body required: true schema: type: object required: – eventReception properties: eventReception: type: object allOf: – #/definitions/eventReceptionResponseRecord description: Retorno da SEFAZ responses: 200: description: OK default: description: Error response schema: #/definitions/genericError /sefaz_gateway/events/nullificationResponse: post: description: Notifica a resposta da inutilização x-senior-event: true tags: – Events parameters: – name: input in: body required: true schema: type: object required: – nullification properties: nullification: type: object allOf: – #/definitions/nullificationResponseRecord description: Retorno da SEFAZ responses: 200: description: OK default: description: Error response schema: #/definitions/genericError /sefaz_gateway/events/dfeDistributionResponse: post: description: Notifica a resposta da consulta de NSUs de distribuição de DF-e x-senior-event: true tags: – Events parameters: – name: input in: body required: true schema: type: object required: – dfeDistribution properties: dfeDistribution: type: object allOf: – #/definitions/dfeDistributionResponseRecord description: Retorno da SEFAZ de distribuição de DF-e responses: 200: description: OK default: description: Error response schema: #/definitions/genericErrordefinitions: upDown: type: string enum: – UP – DOWN description: Up or down: * `UP` – Up * `DOWN` – Down environmentType: type: string enum: – PROD – HOMOLOG – DISABLED – MOCK description: Tipo de aplicação do ambiente: * `PROD` – Produção * `HOMOLOG` – Homolog * `DISABLED` – Desativado * `MOCK` – Utilizado para mockar urls em ambiente de desenvolvimento documentType: type: string enum: – NFE description: Tipo de documento: * `NFE` – NFe urlType: type: string enum: – DOCUMENT_ISSUE – DOCUMENT_ISSUE_STATUS – SEFAZ_STATUS – DOCUMENT_STATUS – EVENT_RECEPTION – NULLIFICATION – DFE_DISTRIBUTION description: Tipo de URL: * `DOCUMENT_ISSUE` – Emissão de documento * `DOCUMENT_ISSUE_STATUS` – Consulta status da emissão de documento (NFeRetAutorizacao) * `SEFAZ_STATUS` – Consulta da situação na Sefaz * `DOCUMENT_STATUS` – Consulta da situação do documento (NfeConsultaProtocolo) * `EVENT_RECEPTION` – Emissao de evento * `NULLIFICATION` – Emissão de inutilização * `DFE_DISTRIBUTION` – Distribuição de documento fiscal eletronicos identificationDocumentType: type: string enum: – CNPJ – CPF description: Tipo de documento: * `CNPJ` – CNPJ * `CPF` – CPF userNotificationKind: type: string enum: – Operational – Management – News description: User notification kind.: * `Operational` – Operational * `Management` – Management * `News` – News userNotificationPriority: type: string enum: – Error – Alert – None description: User notification priority.: * `Error` – Error * `Alert` – Alert * `None` – None eventEmailFormat: type: string enum: – HTML – PLAIN_TEXT description: Format of the email: * `HTML` – Html * `PLAIN_TEXT` – Plain Text checkData: description: Dados do healthcheck type: object required: – name – status properties: name: type: string description: Nome do healthcheck status: type: string allOf: – #/definitions/upDown description: Status do healthcheck createUrlRecord: description: Modelo requisitado para criação de uma nova URL type: object required: – url – documentType – urlType – documentVersion – ibgeStateCode – environmentType properties: url: type: string maxLength: 255 description: URL documentType: type: string allOf: – #/definitions/documentType description: Tipo do documento urlType: type: string allOf: – #/definitions/urlType description: Tipo de URL documentVersion: type: string maxLength: 255 description: Versão do documento ibgeStateCode: type: integer format: int64 description: Código IBGE do estado environmentType: type: string allOf: – #/definitions/environmentType description: Tipo de aplicação do ambiente updateUrlRecord: description: Modelo requisitado para atualização de uma URL type: object required: – id – url – documentType – urlType – documentVersion – ibgeStateCode – environmentType properties: id: type: string maxLength: 255 description: identificação única do registro url: type: string maxLength: 255 description: URL documentType: type: string allOf: – #/definitions/documentType description: Tipo do documento urlType: type: string allOf: – #/definitions/urlType description: Tipo de URL documentVersion: type: string maxLength: 255 description: Versão do documento ibgeStateCode: type: integer format: int64 description: Código IBGE do estado environmentType: type: string allOf: – #/definitions/environmentType description: Tipo de aplicação do ambiente urlShared: description: URL compartilhada type: object required: – id – url – documentType – urlType – documentVersion – ibgeStateCode – environmentType properties: id: type: string maxLength: 255 description: identificação única do registro url: type: string maxLength: 255 description: URL documentType: type: string allOf: – #/definitions/documentType description: Tipo do documento urlType: type: string allOf: – #/definitions/urlType description: Tipo de URL documentVersion: type: string maxLength: 255 description: Versão do documento ibgeStateCode: type: integer format: int64 description: Código IBGE do estado environmentType: type: string allOf: – #/definitions/environmentType description: Tipo de aplicação do ambiente invoiceStatusRecord: description: Dados da NFe para consulta de situação type: object required: – invoiceId – ibgeStateCode – receiptNumber – environmentType – branchId – invoiceAccessKey – version properties: invoiceId: type: string description: ID da NFe ibgeStateCode: type: string description: Código IBGE do estado receiptNumber: type: string description: Numero do recibo do lote environmentType: type: string allOf: – #/definitions/environmentType description: Tipo de ambiente branchId: type: string description: ID da filial invoiceAccessKey: type: string description: Chave de acesso da NFe type: string description: Versão do documento invoiceStatusProtocolRecord: description: Dados da NFe para consulta de situação via protocolo type: object required: – ibgeStateCode – environmentType – branchId – invoiceAccessKey – version properties: invoiceId: type: string description: ID da NFe ibgeStateCode: type: string description: Código IBGE do estado environmentType: type: string allOf: – #/definitions/environmentType description: Tipo de ambiente branchId: type: string description: ID da filial invoiceAccessKey: type: string description: Chave de acesso da NFe type: string description: Versão do documento statusServiceRecord: description: Dados para consulta do status da NF-e type: object required: – ibgeStateCode – environmentType – branchId – version properties: ibgeStateCode: type: string description: Código IBGE do estado environmentType: type: string allOf: – #/definitions/environmentType description: Tipo de ambiente branchId: type: string description: ID da filial type: string description: Versão do documento invoiceStatusResponseRecord: description: Dados da NFe para consulta de status type: object required: – invoiceId – branchId – invoiceAccessKey – statusCode – statusMessage properties: invoiceId: type: string description: ID da NFe branchId: type: string description: ID da filial invoiceAccessKey: type: string description: Chave de acesso da NFe statusCode: type: string description: Código de retorno SEFAZ statusMessage: type: string description: Mensagem de retorno SEFAZ responseXml: type: string description: XML de retorno authorizationDate: type: string format: date description: Data de autorização authorizationProtocol: type: string description: Procolo de autorização digestValue: type: string description: Digest value xmlIntegrated: type: string description: Xml integrado eventReceptionResponseRecord: description: Dados da resposta do evento type: object required: – eventId – invoiceId – branchId – statusCode – statusMessage – invoiceOrigin properties: eventId: type: string description: ID do evento invoiceId: type: string description: ID da NFe branchId: type: string description: ID da filial batchId: type: string description: ID do lote statusCode: type: string description: Código de retorno SEFAZ statusMessage: type: string description: Mensagem de retorno SEFAZ dhRegEvento: type: string description: Data e hora do registro do evento nProt: type: string description: Numero do protocolo do evento responseXml: type: string description: XML de retorno xmlIntegrated: type: string description: Xml integrado invoiceOrigin: type: string description: Origem da nota fiscal nullificationResponseRecord: description: Dados da inutilização type: object required: – nullificationId – branchId – statusCode – statusMessage – dhRecbto – nProt properties: nullificationId: type: string description: ID da inutilização branchId: type: string description: ID da filial statusCode: type: string description: Código de retorno SEFAZ statusMessage: type: string description: Mensagem de retorno SEFAZ dhRecbto: type: string description: Data e hora do registro da inutilização nProt: type: string description: Numero do protocolo da inutilização responseXml: type: string description: XML de retorno xmlIntegrated: type: string description: Xml integrado statusServiceResponseRecord: description: Payload do status service type: object required: – versao – tpAmb – verAplic – cStat – xMotivo – cUF – dhRecbto – tMed – dhRetorno – xObs properties: versao: type: string description: Código versão do layout tpAmb: type: string description: Tipo de ambiente verAplic: type: string description: Versão do aplicativo que processo a consulta cStat: type: string description: Código do status da resposta xMotivo: type: string description: Descrição literal do status da resposta cUF: type: string description: Código da UF que atendeu a solicitação dhRecbto: type: string description: Data e hora do processamento tMed: type: string description: Tempo médio de resposta do serviço (em segundos) dhRetorno: type: string description: Data hora de retorno xObs: type: string description: Inforações adicionais dfeDistributionRequestRecord: description: Payload para consulta de distribuição de DF-e type: object required: – branchId – document – documentType – nsu – environmentType properties: branchId: type: string description: ID da filial document: type: string description: Documento do Emissor documentType: type: string allOf: – #/definitions/identificationDocumentType description: Tipo do documento do Emissor nsu: type: string description: Número do NSU environmentType: type: string allOf: – #/definitions/environmentType description: Tipo de ambiente authorUF: type: string maxLength: 2 description: UF do autor dfeDistributionResponseRecord: description: Payload da resposta de distribuição de DF-e type: object required: – cStat – xMotivo – ultNsu – maxNsu – dfeDistributionBatch properties: cStat: type: string description: Código do status da resposta xMotivo: type: string description: Descrição literal do status da resposta ultNsu: type: string description: Último NSU pesquisado no ambiente nacional maxNsu: type: string description: Maior NSU existente no ambiente nacional para o CNPJ dfeDistributionBatch: type: array items: type: object allOf: – #/definitions/dfeDistributionBatchRecord minimum: 1 description: Lotes de distribuição de DF-e dfeDistributionBatchRecord: description: Registro de lote de distribuição de DF-e type: object required: – docZip – nsu – schema properties: docZip: type: string format: byte description: Documento fiscal eletrônico nsu: type: string description: NSU do documento fiscal eletrônico schema: type: string description: Identificação do Schema XML para validação notifyUserEventPayload: description: Represents a regular user event notification payload discriminator: _discriminator type: object required: – notificationKind – notificationPriority – notificationSubject – notificationContent – sourceDomain – sourceService – destinationUser – _discriminator properties: notificationClass: type: string description: Class of notification notificationOrigin: type: string description: Origin of notification. Free text. Optional. notificationKind: type: string allOf: – #/definitions/userNotificationKind description: Notification kind. notificationPriority: type: string allOf: – #/definitions/userNotificationPriority description: Notification priority. notificationSubject: type: string description: Notification subject. notificationContent: type: string description: Notification content. sourceDomain: type: string description: Domain that generates the notification. sourceService: type: string description: Service that generates the notification. destinationUser: type: string description: Username of the destination user. link: type: string description: Notification link _discriminator: type: string description: emailNotifyUserEventPayload: description: Represents an email notification payload allOf: – #/definitions/notifyUserEventPayload – type: object required: – from properties: from: type: string description: Email sender address sendTo: type: array items: type: string description: Additional recipients to send the email to format: type: string allOf: – #/definitions/eventEmailFormat description: Email format pushNotifyUserEventPayload: description: Represents a push notification payload allOf: – #/definitions/notifyUserEventPayload – type: object required: – applicationId properties: applicationId: type: string description: Apple/Google application id blobReference: description: Default blob reference type. Every service defines its own. type: object required: – targetObjectId properties: domainName: type: string description: The domain the blob belongs to. serviceName: type: string description: The service the blob belongs to. targetObjectId: type: string description: The basic id of the blob. targetCopyId: type: string description: The id of the blob copy. basicErrorPayload: description: Default error payload type. Every service defines its own. type: object properties: message: type: string description: The user-facing error message, if any. errorCode: type: string description: The program-accessible (and service-specific) error code. dependency: description: Represents a service dependency type: object required: – domain – service – version properties: domain: type: string description: Domain of the dependency service service: type: string description: Name of the dependency service type: string description: Version of the dependency service genericError: properties: message: type: string description: Messaging describing the error. reason: type: string enum: – BAD_REQUEST – UNAUTHORIZED – PAYMENT_REQUIRED – FORBIDDEN – OBJECT_NOT_FOUND – REQUEST_TIMEOUT – GONE – UNPROCESSABLE – INTERNAL_ERROR – NOT_IMPLEMENTED – SERVICE_UNAVAILABLE – INSUFFICIENT_STORAGE description: A symbolic code identifying the category of the reason of the error: * `BAD_REQUEST` – Bad Request * `UNAUTHORIZED` – Unauthorized * `PAYMENT_REQUIRED` – Payment Required * `OBJECT_NOT_FOUND` – Object Not Found * `REQUEST_TIMEOUT` – Request Timeout * `GONE` – Gone * `UNPROCESSABLE` – Unprocessable * `INTERNAL_ERROR` – Internal Error * `NOT_IMPLEMENTED` – Not Implemented * `SERVICE_UNAVAILABLE` – Service Unavailable * `INSUFFICIENT_STORAGE` – Insufficient Storage