Create a new company in the system with SUNAT credentials and configuration.
Authentication
This endpoint requires authentication. Include your API token in the request header:
Authorization: Bearer YOUR_API_TOKEN
Request Body
11-digit tax identification number (RUC). Must be unique in the system.
Legal business name (max 255 characters)
Commercial or trading name (max 255 characters)
Business address (max 255 characters)
6-digit UBIGEO code for geographic location
District name (max 100 characters)
Province name (max 100 characters)
Department/region name (max 100 characters)
Phone number (max 20 characters)
Company email address (max 255 characters, must be valid email format)
Company website URL (max 255 characters, must be valid URL)
SUNAT SOL username (max 50 characters)
SUNAT SOL password (max 100 characters)
Digital certificate file (.pem, .crt, .cer, .txt, max 2MB)
Password for the digital certificate (max 100 characters)
Custom SUNAT beta endpoint URL. If not provided, defaults to SUNAT’s standard beta endpoint.
Custom SUNAT production endpoint URL. If not provided, defaults to SUNAT’s standard production endpoint.
Environment mode: true, false, 1, or 0. Defaults to false (beta mode).
Company logo image (.png, .jpg, .jpeg, max 2MB)
Active status. Defaults to true.
Response
Indicates if the company was created successfully
The created company object with configurations Unique identifier for the company
11-digit tax identification number
Array of company configuration objects
Example Request
curl -X POST https://api.yourdomain.com/api/v1/companies \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"ruc": "20123456789",
"razon_social": "EMPRESA DEMO S.A.C.",
"nombre_comercial": "Demo Corp",
"direccion": "Av. Los Olivos 123",
"ubigeo": "150101",
"distrito": "San Isidro",
"provincia": "Lima",
"departamento": "Lima",
"telefono": "01-1234567",
"email": "[email protected] ",
"usuario_sol": "MODDATOS",
"clave_sol": "MODDATOS",
"modo_produccion": false,
"activo": true
}'
$client = new \GuzzleHttp\ Client ();
$response = $client -> request ( 'POST' , 'https://api.yourdomain.com/api/v1/companies' , [
'headers' => [
'Authorization' => 'Bearer YOUR_API_TOKEN' ,
'Content-Type' => 'application/json' ,
],
'json' => [
'ruc' => '20123456789' ,
'razon_social' => 'EMPRESA DEMO S.A.C.' ,
'nombre_comercial' => 'Demo Corp' ,
'direccion' => 'Av. Los Olivos 123' ,
'ubigeo' => '150101' ,
'distrito' => 'San Isidro' ,
'provincia' => 'Lima' ,
'departamento' => 'Lima' ,
'telefono' => '01-1234567' ,
'email' => '[email protected] ' ,
'usuario_sol' => 'MODDATOS' ,
'clave_sol' => 'MODDATOS' ,
'modo_produccion' => false ,
'activo' => true ,
],
]);
echo $response -> getBody ();
const response = await fetch ( 'https://api.yourdomain.com/api/v1/companies' , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer YOUR_API_TOKEN' ,
'Content-Type' : 'application/json'
},
body: JSON . stringify ({
ruc: '20123456789' ,
razon_social: 'EMPRESA DEMO S.A.C.' ,
nombre_comercial: 'Demo Corp' ,
direccion: 'Av. Los Olivos 123' ,
ubigeo: '150101' ,
distrito: 'San Isidro' ,
provincia: 'Lima' ,
departamento: 'Lima' ,
telefono: '01-1234567' ,
email: '[email protected] ' ,
usuario_sol: 'MODDATOS' ,
clave_sol: 'MODDATOS' ,
modo_produccion: false ,
activo: true
})
});
const data = await response . json ();
console . log ( data );
Example Response
{
"success" : true ,
"message" : "Empresa creada exitosamente" ,
"data" : {
"id" : 1 ,
"ruc" : "20123456789" ,
"razon_social" : "EMPRESA DEMO S.A.C." ,
"nombre_comercial" : "Demo Corp" ,
"direccion" : "Av. Los Olivos 123" ,
"ubigeo" : "150101" ,
"distrito" : "San Isidro" ,
"provincia" : "Lima" ,
"departamento" : "Lima" ,
"telefono" : "01-1234567" ,
"email" : "[email protected] " ,
"usuario_sol" : "MODDATOS" ,
"modo_produccion" : false ,
"activo" : true ,
"endpoint_beta" : "https://e-beta.sunat.gob.pe/ol-ti-itcpfegem-beta/billService" ,
"endpoint_produccion" : "https://e-factura.sunat.gob.pe/ol-ti-itcpfegem/billService" ,
"configurations" : [],
"created_at" : "2024-03-05T10:30:00.000000Z" ,
"updated_at" : "2024-03-05T10:30:00.000000Z"
}
}
{
"success" : false ,
"message" : "Errores de validación" ,
"errors" : {
"ruc" : [
"El RUC ya está registrado"
],
"email" : [
"El correo debe tener un formato válido"
]
}
}
{
"success" : false ,
"message" : "Error al crear empresa: Database error"
}
Default Endpoints : If not specified, the system automatically assigns SUNAT’s standard endpoints:
Beta: https://e-beta.sunat.gob.pe/ol-ti-itcpfegem-beta/billService
Production: https://e-factura.sunat.gob.pe/ol-ti-itcpfegem/billService
Security : The clave_sol, certificado_pem, certificado_password, and GRE credentials are hidden in API responses for security.