How to use Codex to automate EFD-Reinf via API
Use Codex with the assessment files on your machine to consult the public OpenAPI, prepare calls, run submissions and track EFD-Reinf outside the portal, using the Guidis Reinf API as the main trail of the automation.
When it makes sense
The gain shows up when the team already has XML, PDF, spreadsheets, CSV and other supporting documents, but wants to turn that material into an executable routine, with validation and technical tracking in the same flow.
Codex makes the most sense when the team wants to operate outside the portal day to day, using the API as the main trail. The portal remains useful to create the credential, handle exceptions and serve as manual fallback, but the routine can be prepared and executed through authenticated calls.
- Assessment files as input - Codex can read XML, PDF, Excel, CSV and supporting documents before preparing the submission data in the integration.
- Public contract as reference - Codex consults the public OpenAPI and the API documentation before building or fixing calls.
- Execution outside the portal - after assembling, Codex can help with submission and with reading receipts and operational returns without depending on the portal as the main interface.
Step by step
- Create the API key - generate it under Administration > Access Control > API Integrations and keep it safe, as it is shown only once.
- Obtain the access token - exchange the API key for a token at
POST /api/integracao/tokenbefore any Codex call. - Validate the context and read the files - start with
GET /v1/integracao/contextoand only then ask Codex to read the assessment files and the flow documents. - Assemble, review and run - use the public OpenAPI to organize the submission data, review taxpayer, environment and period, and only then transmit.
Practical example
First make sure you have the account API key and token:
POST /api/integracao/token
Authorization: Bearer YOUR_API_KEY
Base prompt for the operational preparation:
Read the assessment files for this routine on my machine, consult the public OpenAPI of Guidis Reinf, organize the data of the flow I need to submit and highlight any uncertain field before preparing the API call.
Keep the manual fallback in the portal when the routine needs intervention. See also the full API documentation and the Claude Code version.
After submission, use the same integration to check status, receipts, returns and operational evidence. Automation should not end at the POST: it needs to follow the fiscal result until there is enough proof for the operation.