Update an existing company’s information and configuration.
Authentication
This endpoint requires authentication. Include your API token in the request header:
Authorization: Bearer YOUR_API_TOKEN
Path Parameters
The unique identifier of the company to update
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
Custom SUNAT production endpoint URL
Environment mode: true, false, 1, or 0
Company logo image (.png, .jpg, .jpeg, max 2MB)
Response
Indicates if the update was successful
The updated company object with configurations
Unique identifier for the company
11-digit tax identification number
Array of company configuration objects
Example Request
curl -X PUT https://api.yourdomain.com/api/v1/companies/1 \
-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 Updated",
"direccion": "Av. Los Olivos 456",
"ubigeo": "150101",
"distrito": "San Isidro",
"provincia": "Lima",
"departamento": "Lima",
"telefono": "01-7654321",
"email": "[email protected]",
"usuario_sol": "MODDATOS",
"clave_sol": "MODDATOS",
"modo_produccion": false
}'
$client = new \GuzzleHttp\Client();
$response = $client->request('PUT', 'https://api.yourdomain.com/api/v1/companies/1', [
'headers' => [
'Authorization' => 'Bearer YOUR_API_TOKEN',
'Content-Type' => 'application/json',
],
'json' => [
'ruc' => '20123456789',
'razon_social' => 'EMPRESA DEMO S.A.C.',
'nombre_comercial' => 'Demo Corp Updated',
'direccion' => 'Av. Los Olivos 456',
'ubigeo' => '150101',
'distrito' => 'San Isidro',
'provincia' => 'Lima',
'departamento' => 'Lima',
'telefono' => '01-7654321',
'email' => '[email protected]',
'usuario_sol' => 'MODDATOS',
'clave_sol' => 'MODDATOS',
'modo_produccion' => false,
],
]);
echo $response->getBody();
const response = await fetch('https://api.yourdomain.com/api/v1/companies/1', {
method: 'PUT',
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 Updated',
direccion: 'Av. Los Olivos 456',
ubigeo: '150101',
distrito: 'San Isidro',
provincia: 'Lima',
departamento: 'Lima',
telefono: '01-7654321',
email: '[email protected]',
usuario_sol: 'MODDATOS',
clave_sol: 'MODDATOS',
modo_produccion: false
})
});
const data = await response.json();
console.log(data);
Example Response
{
"success": true,
"message": "Empresa actualizada exitosamente",
"data": {
"id": 1,
"ruc": "20123456789",
"razon_social": "EMPRESA DEMO S.A.C.",
"nombre_comercial": "Demo Corp Updated",
"direccion": "Av. Los Olivos 456",
"ubigeo": "150101",
"distrito": "San Isidro",
"provincia": "Lima",
"departamento": "Lima",
"telefono": "01-7654321",
"email": "[email protected]",
"usuario_sol": "MODDATOS",
"modo_produccion": false,
"activo": true,
"configurations": [],
"created_at": "2024-03-05T10:30:00.000000Z",
"updated_at": "2024-03-05T14:20:00.000000Z"
}
}
{
"success": false,
"message": "Errores de validación",
"errors": {
"email": [
"El correo debe tener un formato válido"
]
}
}
{
"success": false,
"message": "No query results for model [App\\Models\\Company] 999"
}
{
"success": false,
"message": "Error al actualizar empresa: Database error"
}
Changes to the company are logged automatically. The system tracks which fields were modified during the update.
If the company has associated documents (invoices, guides, etc.), certain fields may be restricted from modification to maintain data integrity.