Skip to main content
PUT
/
api
/
v1
/
companies
/
{id}
Update Company
curl --request PUT \
  --url https://api.example.com/api/v1/companies/{id}
{
  "success": true,
  "message": "<string>",
  "data": {
    "id": 123,
    "ruc": "<string>",
    "razon_social": "<string>",
    "direccion": "<string>",
    "email": "<string>",
    "modo_produccion": true,
    "activo": true,
    "configurations": [
      {}
    ],
    "updated_at": "<string>"
  }
}
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

id
integer
required
The unique identifier of the company to update

Request Body

ruc
string
required
11-digit tax identification number (RUC). Must be unique in the system.
razon_social
string
required
Legal business name (max 255 characters)
nombre_comercial
string
Commercial or trading name (max 255 characters)
direccion
string
required
Business address (max 255 characters)
ubigeo
string
required
6-digit UBIGEO code for geographic location
distrito
string
required
District name (max 100 characters)
provincia
string
required
Province name (max 100 characters)
departamento
string
required
Department/region name (max 100 characters)
telefono
string
Phone number (max 20 characters)
email
string
required
Company email address (max 255 characters, must be valid email format)
web
string
Company website URL (max 255 characters, must be valid URL)
usuario_sol
string
required
SUNAT SOL username (max 50 characters)
clave_sol
string
required
SUNAT SOL password (max 100 characters)
certificado_pem
file
Digital certificate file (.pem, .crt, .cer, .txt, max 2MB)
certificado_password
string
Password for the digital certificate (max 100 characters)
endpoint_beta
string
Custom SUNAT beta endpoint URL
endpoint_produccion
string
Custom SUNAT production endpoint URL
modo_produccion
string
Environment mode: true, false, 1, or 0
logo_path
file
Company logo image (.png, .jpg, .jpeg, max 2MB)
activo
boolean
Active status

Response

success
boolean
required
Indicates if the update was successful
message
string
required
Success message
data
object
required
The updated company object with configurations

Example Request

cURL
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
  }'
PHP
$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();
JavaScript
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

200 OK
{
  "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"
  }
}
422 Validation Error
{
  "success": false,
  "message": "Errores de validación",
  "errors": {
    "email": [
      "El correo debe tener un formato válido"
    ]
  }
}
404 Not Found
{
  "success": false,
  "message": "No query results for model [App\\Models\\Company] 999"
}
500 Error
{
  "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.

Build docs developers (and LLMs) love