Skip to main content
PUT
/
api
/
profiles
/
{id}
Update Profile
curl --request PUT \
  --url https://api.example.com/api/profiles/{id} \
  --header 'Content-Type: application/json' \
  --data '
{
  "nombre": "<string>",
  "rfc": "<string>",
  "tipo_persona": "<string>",
  "regimenes_fiscales": [
    {}
  ],
  "validaciones_habilitadas": {}
}
'
{
  "message": "<string>",
  "data": {
    "id": "<string>",
    "user_id": "<string>",
    "nombre": "<string>",
    "rfc": "<string>",
    "tipo_persona": "<string>",
    "regimenes_fiscales": [
      {}
    ],
    "validaciones_habilitadas": {},
    "frozen": true,
    "frozen_reason": "<string>",
    "frozen_at": "<string>",
    "created_at": "<string>",
    "updated_at": "<string>"
  }
}
Update an existing profile.

Authentication

This endpoint requires Bearer token authentication. Include the JWT token in the Authorization header.
Authorization: Bearer <your_token>

Path Parameters

id
string
required
Profile unique identifier (UUID format)Validation:
  • Must be a valid UUID
  • Profile must belong to the authenticated user

Request Body

All fields are optional. Only include the fields you want to update.
nombre
string
Profile nameValidation:
  • Minimum length: 2 characters
  • Maximum length: 255 characters
  • Will be trimmed of whitespace
rfc
string
Mexican tax ID (RFC)Validation:
  • Must match RFC format: ^[A-Z&Ñ]{3,4}\d{6}[A-V1-9][A-Z1-9][0-9A]$
  • Case-insensitive (will be normalized to uppercase)
  • Must be unique across all users (one RFC per Contafy account)
  • Will be trimmed of whitespace
tipo_persona
string
Type of person/entityAllowed values:
  • FISICA - Individual person
  • MORAL - Company/Legal entity
regimenes_fiscales
array
Array of tax regime codes (SAT format)Validation:
  • Must be an array of strings
  • Each element must be a non-empty string
  • Empty strings will be filtered out
  • Pass empty array [] to clear all regimes
validaciones_habilitadas
object
Custom validation settingsValidation:
  • Must be a valid JSON object
  • Pass empty object {} to clear all validations

Response

Returns the updated profile object.
message
string
required
Success message
data
object
required
Updated profile object with all fields
id
string
required
Profile unique identifier (UUID)
user_id
string
required
Owner user ID (UUID)
nombre
string
required
Profile name
rfc
string
required
Normalized RFC (uppercase)
tipo_persona
string
required
Person type: FISICA or MORAL
regimenes_fiscales
array
required
Array of tax regime codes
validaciones_habilitadas
object
required
Custom validation settings
frozen
boolean
required
Whether the profile is frozen
frozen_reason
string
Reason for freezing if applicable
frozen_at
string
ISO 8601 timestamp when profile was frozen
created_at
string
required
ISO 8601 timestamp of profile creation
updated_at
string
required
ISO 8601 timestamp of last update (will be current time)

Example Request

curl -X PUT https://api.contafy.com/api/profiles/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Mi Nueva Empresa S.A. de C.V.",
    "regimenes_fiscales": ["601", "603", "605"]
  }'

Example Response

{
  "message": "Perfil actualizado exitosamente",
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "user_id": "123e4567-e89b-12d3-a456-426614174000",
    "nombre": "Mi Nueva Empresa S.A. de C.V.",
    "rfc": "EMP840101ABC",
    "tipo_persona": "MORAL",
    "regimenes_fiscales": ["601", "603", "605"],
    "validaciones_habilitadas": {},
    "frozen": false,
    "frozen_reason": null,
    "frozen_at": null,
    "fiel_cer_encrypted": null,
    "fiel_key_encrypted": null,
    "fiel_password_encrypted": null,
    "sat_download_last_sync_at": null,
    "sat_download_sync_enabled": false,
    "created_at": "2024-03-07T12:00:00.000Z",
    "updated_at": "2024-03-07T13:30:00.000Z"
  }
}

Error Responses

400 Bad Request
Validation errors in request body or invalid UUID
{
  "errors": [
    {
      "field": "id",
      "message": "ID de perfil inválido"
    },
    {
      "field": "nombre",
      "message": "El nombre debe tener entre 2 y 255 caracteres"
    },
    {
      "field": "rfc",
      "message": "Formato de RFC inválido"
    },
    {
      "field": "tipo_persona",
      "message": "El tipo de persona debe ser FISICA o MORAL"
    }
  ]
}
401 Unauthorized
User is not authenticated or token is invalid
{
  "error": "Usuario no autenticado"
}
404 Not Found
Profile not found or does not belong to authenticated user
{
  "error": "Perfil no encontrado"
}
409 Conflict
RFC already in use by another user
{
  "error": "Este RFC ya está en uso",
  "message": "Este RFC ya está registrado en Contafy por otro usuario. Si requiere ayuda para resolver este problema, contacte a [email protected]",
  "code": "RFC_IN_USE"
}
500 Internal Server Error
Server error occurred while updating profile
{
  "error": "Error al actualizar perfil"
}

Important Notes

  • Only include the fields you want to update
  • Omitted fields will retain their current values
  • Users can only update profiles that belong to them
  • When updating RFC, it must still be unique across all Contafy accounts
  • RFCs are automatically normalized to uppercase
  • Empty strings in regimenes_fiscales array are filtered out

Build docs developers (and LLMs) love