Period Locks

Period Locks

Period locks are used to prevent modifications to accounting data in closed periods. This helps maintain data integrity and ensures compliance with accounting regulations by preventing unauthorized changes to historical records.

Endpoints

List Period Locks

GET /api/v2/period-locks

Retrieves a paginated list of period locks for a specific client account.

Query Parameters

Parameter Type Required Description
client_account_id integer Yes The ID of the client account
page integer No Page number (default: 1)
per_page integer No Items per page (default: 100, max: 100)
with string No Include related resources (supported: created_by)

Response

{
  "data": [
    {
      "id": 123,
      "client_account_id": 456,
      "locked_until_date": "2024-03-31",
      "locking_comment": "Q1 2024 closed",
      "created_at": "2024-04-01T10:00:00Z",
      "created_by_id": 789,
      "created_by": {  // Only included when with=created_by
        "id": 789,
        "first_name": "John",
        "last_name": "Doe",
        "created_at": "2023-01-01T00:00:00Z",
        "profile_image_url": null,
        "last_login": "2024-03-15T14:30:00Z"
      }
    }
  ],
  "meta": {
    "page": 1,
    "pages": 1,
    "per_page": 100,
    "records": 1
  }
}

Create Period Lock

POST /api/v2/period-locks

Creates a new period lock for a client account.

Request Body

Field Type Required Description
client_account_id integer Yes The ID of the client account
locked_until_date string Yes The date until which the period is locked (YYYY-MM-DD)
locking_comment string Yes Comment explaining the reason for the lock

Example Request

{
  "client_account_id": 456,
  "locked_until_date": "2024-03-31",
  "locking_comment": "Q1 2024 closed"
}

Response

{
  "id": 123,
  "client_account_id": 456,
  "locked_until_date": "2024-03-31",
  "locking_comment": "Q1 2024 closed",
  "created_at": "2024-04-01T10:00:00Z",
  "created_by_id": 789
}

Error Responses

Status Code Description
400 Invalid request (e.g., missing required fields)
403 Forbidden (no access to client account)

Business Rules

  1. Period locks can only be created, not updated or deleted
  2. Users must have access to the client account to create or view period locks
  3. The locked_until_date must be a valid date in YYYY-MM-DD format
  4. A locking comment must be provided to document the reason for the lock

Common Use Cases

  1. Locking completed accounting periods after month-end closing
  2. Preventing modifications to historical data after tax reporting
  3. Maintaining data integrity during audits
  4. Ensuring compliance with accounting regulations

Best Practices

  1. Always provide clear and descriptive locking comments
  2. Set period locks immediately after completing period-end procedures
  3. Consider regulatory requirements when determining lock periods
  4. Review existing period locks before creating new ones

Relaterte artikler