OnAPI Service (1.0.3)
Welcome to our SUNAT Electronic Invoices API portal.
In this space, you can perform Tax Intelligence operations such as:
- Generation and management of CPEs in a controlled SUNAT testing environment;
- OpenAI Artificial Intelligence tools applied to CPEs;
- Validation and identity verification tools from RENIEC;
- Support tools for CPEs, and more.
https://e-hom-onapi.factura-core.com/integrator/api/v1/
https://e-prod-onapi.factura-core.com/integrator/api/v1/
https://e-dev-onapi.factura-core.com/integrator/api/v1/
Authentication
Credential Generation
The team will generate and provide credentials (username and password). This step will be performed only once.
Token Generation
Using the credentials obtained in the previous step, the user will generate a token through a service provided by the team for this purpose.
This token will have a validity period, which is indicated in the service response. Within this period, the token can be used as many times as needed to invoke the services.
Request
Authenticates a user using their credentials and returns an access token along with a refresh token.
This endpoint is typically used as the first step in the authentication flow. It verifies the user's credentials (e.g., username and password) and, if valid, issues tokens that can be used to access protected resources.
The returned access token should be included in the Authorization
header of subsequent API requests using the Bearer scheme.
Tokens:
- The access token is typically short-lived and used to authorize API requests.
- The refresh token is long-lived and can be used to obtain a new access token without re-authenticating.
Security Notes:
- Credentials should be transmitted over HTTPS to ensure security.
- Refresh tokens must be securely stored and never exposed to third parties.
- Multiple failed login attempts may result in temporary blocking or rate limiting.
Authentication endpoint
- Homologation Environment
https://e-hom-onapi.factura-core.com/integrator/api/v1/integrator/authenticate
- Production Environment
https://e-prod-onapi.factura-core.com/integrator/api/v1/integrator/authenticate
- Development Environment
https://e-dev-onapi.factura-core.com/integrator/api/v1/integrator/authenticate
- curl
- Java
- Python
curl -i -X POST \
https://e-hom-onapi.factura-core.com/integrator/api/v1/integrator/authenticate \
-H 'Content-Type: application/json' \
-d '{
"clientId": "integra",
"username": "api@coredobrasil.com.br",
"password": "core",
"grantType": "password"
}'
{ "token": "string", "refresh_token": "string", "expiresIn": 0 }
Request
Exchanges a valid refresh token for a new access token (and optionally a new refresh token).
This endpoint is used to keep the user authenticated without requiring them to log in again. It should be called before the current access token expires.
The client must send a valid refresh token, typically received from the login or token exchange endpoint.
If the refresh token is valid and not expired or revoked, the response will contain a new access token. Depending on server configuration, a new refresh token may also be issued.
Security Notes:
- Refresh tokens must be kept secure and should not be shared or exposed.
- Reuse of refresh tokens after logout or expiration will result in an error.
- Clients should always update their stored refresh token if a new one is provided in the response.
Refresh Token endpoint
- Homologation Environment
https://e-hom-onapi.factura-core.com/integrator/api/v1/integrator/refresh-token
- Production Environment
https://e-prod-onapi.factura-core.com/integrator/api/v1/integrator/refresh-token
- Development Environment
https://e-dev-onapi.factura-core.com/integrator/api/v1/integrator/refresh-token
- curl
- Java
- Python
curl -i -X POST \
https://e-hom-onapi.factura-core.com/integrator/api/v1/integrator/refresh-token \
-H 'Authorization: Bearer <YOUR_JWT_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"refreshToken": "string"
}'
{ "token": "string", "expiresIn": 0 }
Logs
Retrieves the most recent API request logs processed by the integrator service. This endpoint returns detailed information for each request, including the HTTP method, endpoint path, request headers, body content, and the timestamp when the request was received. The number of logs returned is controlled by the limit
path parameter.