ROSE Developers - Web API Reference

Taxes | SAF-T (PT)

TheLegal Declarations end point is used to manage SAFT-PT. Mandatory for Portugueses companies.

Overview


URL api/{tenantKey}/{orgKey}/taxes/legalDeclarations
Methods Supported GET, POST, PUT, DELETE

All Operations

This service includes the following operations:

All Resources

This service uses the following resources:

All Enumerations

This service uses the following enumerations:

GET Operations

GET LegalDeclarations

Returns the list of all the entity records available.

Response:

When successful, the response body contains the list of records available. See LegalDeclarationResource.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

GET /taxes/legalDeclarations

GET LegalDeclarations (paged)

Returns a page of the list of all the entity records available.

The following elements are optional:

page (int) The index of the page of the list that should be returned. This is a query string parameter.
pageSize (int) The number of page elements that should be returned (max. is 1000). This is a query string parameter.

Response:

When successful, the response body contains the list of records available. See LegalDeclarationResource.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

GET /taxes/legalDeclarations?page={page}&pageSize={pageSize}

GET LegalDeclaration by identifier

Returns the entity record that matches the specified identifier.

The following elements are required:

id (string) The record identifier.

Response:

When successful, the response body contains the entity record. See LegalDeclarationResource.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.
404 NotFound. The specified record does not exist.

Resource URL:

GET /taxes/legalDeclarations/{id}

GET LegalDeclaration by key

Returns the entity record that matches the specified key.

The following elements are required:

companyKey (string) The company key.
legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.

Response:

When successful, the response body contains the entity record. See LegalDeclarationResource.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.
404 NotFound. The specified record does not exist.

Resource URL:

GET /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}

GET Print LegalDeclaration by identifier

Prints the specified entity record.

The following elements are required:

id (string) The record identifier.

The following elements are optional:

template (string) The report template that should be used. This is a query string parameter.

Response:

When successful, the response body contains a stream with the printed file.

Response status codes:

200 OK. The operation was completed successfully.
404 NotFound. The specified resord does not exist.

Resource URL:

GET /taxes/legalDeclarations/{id}/print?template={template}

GET Print LegalDeclaration by key

Prints the specified entity record.

The following elements are required:

companyKey (string) The company key.
legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.

The following elements are optional:

template (string) The report template that should be used. This is a query string parameter.

Response:

When successful, the response body contains a stream with the printed file.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.
404 NotFound. The specified record does not exist.

Resource URL:

GET /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/print

GET Original Print LegalDeclarationOriginal by identifier

Prints the specified entity record.

The following elements are required:

id (string) The record identifier.

The following elements are optional:

template (string) The report template that should be used. This is a query string parameter.

Response:

When successful, the response body contains a stream with the printed file.

Response status codes:

200 OK. The operation was completed successfully.
404 NotFound. The specified resord does not exist.

Resource URL:

GET /taxes/legalDeclarations/{id}/printOriginal?template={template}

GET Original Print LegalDeclaration by key

Prints the specified entity record.

The following elements are required:

companyKey (string) The company key.
legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.

The following elements are optional:

template (string) The report template that should be used. This is a query string parameter.

Response:

When successful, the response body contains a stream with the printed file.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.
404 NotFound. The specified record does not exist.

Resource URL:

GET /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/printOriginal

POST Operations

POST LegalDeclarations

Creates a new entity record.

The following elements are required:

legalDeclarationResource (ApiLegalDeclarationResource) The request body should contain the entity record that should be created.
See ApiLegalDeclarationResource.

Response:

When successful, the response body contains the new entity record identifier. The resource header location property contains the URL for the new entity record. See ApiLegalDeclarationResource.

Response status codes:

201 Created. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

POST /taxes/legalDeclarations

POST Legal Statement

Inserts a new 'Legal Statement Line' in the 'Legal Statement'.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
companyKey (string) The company key.
value (ApiLegalDeclarationLegalDeclarationLinesResource) The ApiLegalDeclarationLegalDeclarationLinesResource instance.
See ApiLegalDeclarationLegalDeclarationLinesResource.

Response:

When successful, the response body is empty.

Response status codes:

204 NoContent. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

POST /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/legalDeclarationLines

PUT Operations

PUT Set Company LegalDeclaration

Updates the value of attribute 'Company' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
companyKey (string) The company key.
value (string) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/company

PUT Set CompanyTaxId LegalDeclarationLine

Updates the value of attribute 'CompanyTaxId' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
lineId (string) The detail identifier.
companyKey (string) The company key.
value (string) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/legalDeclarationLines/{lineId}/companyTaxId

PUT Set Currency LegalDeclaration

Updates the value of attribute 'Currency' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
companyKey (string) The company key.
value (string) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/currency

PUT Set Currency LegalDeclarationLine

Updates the value of attribute 'Currency' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
lineId (string) The detail identifier.
companyKey (string) The company key.
value (string) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/legalDeclarationLines/{lineId}/currency

PUT Set DocumentDate LegalDeclarationLine

Updates the value of attribute 'DocumentDate' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
lineId (string) The detail identifier.
companyKey (string) The company key.
value (DateTime) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/legalDeclarationLines/{lineId}/documentDate

PUT Set IsActive LegalDeclaration

Updates the value of attribute 'IsActive' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
companyKey (string) The company key.
value (bool) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.
404 NotFound. The specified record does not exist.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/isActive

PUT Set IsPrinted LegalDeclaration

Updates the value of attribute 'IsPrinted' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
companyKey (string) The company key.
value (bool) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/isPrinted

PUT Set Note LegalDeclaration

Updates the value of attribute 'Note' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
companyKey (string) The company key.
value (string) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/note

PUT Set NumberOfDocuments LegalDeclaration

Updates the value of attribute 'NumberOfDocuments' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
companyKey (string) The company key.
value (int) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/numberOfDocuments

PUT Set Party LegalDeclarationLine

Updates the value of attribute 'Party' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
lineId (string) The detail identifier.
companyKey (string) The company key.
value (string) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/legalDeclarationLines/{lineId}/party

PUT Set Remarks LegalDeclaration

Updates the value of attribute 'Remarks' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
companyKey (string) The company key.
value (string) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/remarks

PUT Set SaftDocument LegalDeclaration

Updates the value of attribute 'SaftDocument' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
companyKey (string) The company key.
value (string) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/saftDocument

PUT Set SourceDoc LegalDeclarationLine

Updates the value of attribute 'SourceDoc' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
lineId (string) The detail identifier.
companyKey (string) The company key.
value (string) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/legalDeclarationLines/{lineId}/sourceDoc

PUT Set SourceDocId LegalDeclarationLine

Updates the value of attribute 'SourceDocId' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
lineId (string) The detail identifier.
companyKey (string) The company key.
value (Guid) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/legalDeclarationLines/{lineId}/sourceDocId

PUT Set SourceSchemaEntityId LegalDeclarationLine

Updates the value of attribute 'SourceSchemaEntityId' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
lineId (string) The detail identifier.
companyKey (string) The company key.
value (Guid) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/legalDeclarationLines/{lineId}/sourceSchemaEntityId

PUT Set Status LegalDeclaration

Updates the value of attribute 'Status' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
companyKey (string) The company key.
value (enum LegalDeclarationState) The request body should contain the new value for the attribute.
See LegalDeclarationState.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/status

PUT Set TaxableAmount LegalDeclarationLine

Updates the value of attribute 'TaxableAmount' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
lineId (string) The detail identifier.
companyKey (string) The company key.
value (decimal) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/legalDeclarationLines/{lineId}/taxableAmount

PUT Set TaxAmount LegalDeclarationLine

Updates the value of attribute 'TaxAmount' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
lineId (string) The detail identifier.
companyKey (string) The company key.
value (decimal) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/legalDeclarationLines/{lineId}/taxAmount

PUT Set TotalCredit LegalDeclaration

Updates the value of attribute 'TotalCredit' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
companyKey (string) The company key.
value (decimal) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/totalCredit

PUT Set TotalDebit LegalDeclaration

Updates the value of attribute 'TotalDebit' in the specified entity record.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
companyKey (string) The company key.
value (decimal) The request body should contain the new value for the attribute.

Response:

When successful, the response body is empty.

Response status codes:

200 OK. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.

Resource URL:

PUT /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/totalDebit

DELETE Operations

DELETE Legal Statement Line by identifier

Deletes the entity record that matches the specified identifier.

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
companyKey (string) The company key.
lineId (string) The line identifier.

Response:

When successful, the response body is empty.

Response status codes:

204 NoContent. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.
404 NotFound. The specified record does not exist.

Resource URL:

DELETE /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}/legalDeclarationLines/{lineId}

DELETE LegalDeclaration by identifier

Deletes the entity record that matches the specified identifier.

The following elements are required:

id (string) The record identifier.

Response:

When successful, the response body is empty.

Response status codes:

204 Deleted. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.
404 NotFound. The specified record does not exist.

Resource URL:

DELETE /taxes/legalDeclarations/{id}

DELETE LegalDeclaration by key

Deletes the entity record that matches the specified key.

The following elements are required:

companyKey (string) The company key.
legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.

Response:

When successful, the response body is empty.

Response status codes:

204 Deleted. The operation was completed successfully.
400 BadRequest. The request parameters are invalid.
404 NotFound. The specified record does not exist.

Resource URL:

DELETE /taxes/legalDeclarations/{companyKey}/{legalDeclarationKey}

Resources


ApiLegalDeclarationLegalDeclarationLinesResource

The following elements are required:

sourceDoc (string) The source document using the format {..}. Indicates the original document included on SAF-T.
sourceDocId (Guid) The source document's identifier. Indicates the original document included on SAF-T.
sourceSchemaEntityId (Guid) The source schema entity's identifier. Indicates the schema entity of the original document included on SAF-T.
taxableAmount (MoneyResource) The taxable amount of the original document included on SAF-T.
See MoneyResource .
taxAmount (MoneyResource) The tax amount of the original document included on SAF-T.
See MoneyResource .
currency (string) Indicates the currency of the original document.

The following elements are optional:

documentDate (DateTime) The date of the original document included on SAF-T.
companyTaxId (string) The unique code assigned by a country's tax authority to establish an entity's fiscal identification and responsibilities. Identify the entity of the original document.
party (string) Indicates the entity of the original document.


ApiLegalDeclarationResource

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
documentDate (DateTime) The document's date.
startDate (DateTime) The legal declaration's initial date. Sets the date from which documents should be included on SAF-T.
endDate (DateTime) The legal declaration's final date. Sets the date up to which documents should be included on SAF-T.
totalCredit (MoneyResource) The legal declaration's total credit. Indicates the total amount of documents of type credit included on SAF-T.
See MoneyResource .
totalDebit (MoneyResource) The legal declaration's total debit. Indicates the total amount of documents of type debit included on SAF-T.
See MoneyResource .
company (string) The legal declaration's company. The company code is the central organizational unit within the system.
status (enum LegalDeclarationState) The legal declaration's status.
See LegalDeclarationState.
currency (string) The legal declaration's currency. Indicates the money unit used by the generated document.
auditFileVersion (enum AuditFileVersion) The audit file's version. Indicates the SAF-T version used in the legal declaration.
See AuditFileVersion.
legalDeclarationPurpose (enum LegalDeclarationPurpose) The legal declaration's purpose.
See LegalDeclarationPurpose.

The following elements are optional:

legalDeclarationLines (List of ApiLegalDeclarationLegalDeclarationLinesResource) The legal declaration's lines.
See ApiLegalDeclarationLegalDeclarationLinesResource.
note (string) The legal declaration's note.
remarks (string) The legal declaration's remarks.
isPrinted (bool) Indicates if the legal declaration has been printed. Internally determined.
numberOfDocuments (int) The number of documents included on SAF-T.
saftDocument (string) The saft document.


LegalDeclarationLineResource

The following elements are required:

sourceDoc (string) The source document using the format {..}. Indicates the original document included on SAF-T.
sourceDocId (Guid) The source document's identifier. Indicates the original document included on SAF-T.
sourceSchemaEntityId (Guid) The source schema entity's identifier. Indicates the schema entity of the original document included on SAF-T.
taxableAmount (MoneyResource) The taxable amount of the original document included on SAF-T.
See MoneyResource .
taxAmount (MoneyResource) The tax amount of the original document included on SAF-T.
See MoneyResource .
currency (string) Indicates the currency of the original document.

The following elements are optional:

documentDate (DateTime) The date of the original document included on SAF-T.
companyTaxId (string) The unique code assigned by a country's tax authority to establish an entity's fiscal identification and responsibilities. Identify the entity of the original document.
party (string) Indicates the entity of the original document.


LegalDeclarationResource

The following elements are required:

legalDeclarationKey (string) The legal declaration's key. By default, it is a sequential number.
documentDate (DateTime) The document's date.
startDate (DateTime) The legal declaration's initial date. Sets the date from which documents should be included on SAF-T.
endDate (DateTime) The legal declaration's final date. Sets the date up to which documents should be included on SAF-T.
totalCredit (MoneyResource) The legal declaration's total credit. Indicates the total amount of documents of type credit included on SAF-T.
See MoneyResource .
totalDebit (MoneyResource) The legal declaration's total debit. Indicates the total amount of documents of type debit included on SAF-T.
See MoneyResource .
company (string) The legal declaration's company. The company code is the central organizational unit within the system.
(fk) Allowed value: the natural key of a record of type Company. These records are accessibly through the Companies service.
status (enum LegalDeclarationState) The legal declaration's status.
See LegalDeclarationState.
currency (string) The legal declaration's currency. Indicates the money unit used by the generated document.
(fk) Allowed value: the natural key of a record of type Currency. These records are accessibly through the Currencies service.
auditFileVersion (enum AuditFileVersion) The audit file's version. Indicates the SAF-T version used in the legal declaration.
See AuditFileVersion.
legalDeclarationPurpose (enum LegalDeclarationPurpose) The legal declaration's purpose.
See LegalDeclarationPurpose.

The following elements are optional:

legalDeclarationLines (List of LegalDeclarationLineResource) The legal declaration's lines.
See LegalDeclarationLineResource.
note (string) The legal declaration's note.
remarks (string) The legal declaration's remarks.
isPrinted (bool) Indicates if the legal declaration has been printed. Internally determined.
numberOfDocuments (int) The number of documents included on SAF-T.
saftDocument (string) The saft document.


MoneyResource

The following elements are required:

amount (decimal) The amount.

The following elements are optional:

baseAmount (decimal) The base amount.
reportingAmount (decimal) The reporting amount.
fractionDigits (int) The fraction digits.
symbol (string) The symbol.

Notes: For the POST operation it is not necessary to send the fields: BaseAmount, ReportingAmount, FractionDigits and Symbol. Will be ignored.



Enumerations


AuditFileVersion

2 Version10301
4 Version10401


LegalDeclarationPurpose

1 MultidocumentFile
3 MovementOfGoodsDeclaration
4 Auditing
5 Accounting


LegalDeclarationState

1 Pending
2 Processing
3 Succeeded
4 Failed