# Close a period: accruals, provisioning and closure

To close a period you accrue income up to the period end, generate provisioning for the loan book, check the postings, and then close accounting so nothing more can be posted into the period.

## Before you start

- Ledger accounts: The accounts the period posts to. (https://developer.lokta.ai/guides/accounting-setup/)
- Provisioning criteria: They set the provisioning percentages for the loan products you select. (https://developer.lokta.ai/api/provisioning-accruals/)
- The period end date: Accruals, provisioning and the closure all take it.

## Set your environment

Every request authenticates with HTTP Basic and names its tenant in a header. Set these once and the commands below work as written.

```bash
export LOKTA_API="https://default.lokta.tech"
export LOKTA_USER="your-username"
export LOKTA_PASS="your-password"
```

## 1. Run periodic accruals

Accrual accounting takes income up to the date you give. The date is the only mandatory field.

[POST /v1/runaccruals](https://developer.lokta.ai/api/provisioning-accruals/execute-periodic-accrual-accounting.md)

```bash
curl -X POST "$LOKTA_API/lokta-lms/api/v1/runaccruals" \
  -u "$LOKTA_USER:$LOKTA_PASS" \
  -H "Tenant-Identifier: default" \
  -H "Content-Type: application/json" \
  -d '{
    "tillDate": "31 August 2026",
    "dateFormat": "dd MMMM yyyy",
    "locale": "en"
  }'
```

## 2. Generate provisioning entries

Generate the provisioning entries for a date. Set createjournalentries to true to create the matching journal entries in the same call.

[POST /v1/provisioningentries](https://developer.lokta.ai/api/provisioning-accruals/create-provisioning-entries.md)

```bash
curl -X POST "$LOKTA_API/lokta-lms/api/v1/provisioningentries" \
  -u "$LOKTA_USER:$LOKTA_PASS" \
  -H "Tenant-Identifier: default" \
  -H "Content-Type: application/json" \
  -d '{
    "date": "31 August 2026",
    "createjournalentries": true,
    "dateFormat": "dd MMMM yyyy",
    "locale": "en"
  }'
```

## 3. Check the provisioning entries

List the entries that have been generated and open the one you just created.

[GET /v1/provisioningentries](https://developer.lokta.ai/api/provisioning-accruals/retrieve-all-provisioning-entries.md)

```bash
curl -X GET "$LOKTA_API/lokta-lms/api/v1/provisioningentries" \
  -u "$LOKTA_USER:$LOKTA_PASS" \
  -H "Tenant-Identifier: default"
```

## 4. Review the journal entries

Read the postings for the period before you close it. After the closure, entries prior to the closing date can no longer be posted or reversed for that office.

[GET /v1/journalentries](https://developer.lokta.ai/api/journal-entries/retrieve-all-journal-entries.md)

```bash
curl -X GET "$LOKTA_API/lokta-lms/api/v1/journalentries" \
  -u "$LOKTA_USER:$LOKTA_PASS" \
  -H "Tenant-Identifier: default"
```

## 5. Close accounting for the office

A closure needs the office and the closing date. Comments are optional.

[POST /v1/glclosures](https://developer.lokta.ai/api/accounting-setup/create-glclosure.md)

```bash
curl -X POST "$LOKTA_API/lokta-lms/api/v1/glclosures" \
  -u "$LOKTA_USER:$LOKTA_PASS" \
  -H "Tenant-Identifier: default" \
  -H "Content-Type: application/json" \
  -d '{
    "officeId": 1,
    "closingDate": "31 August 2026",
    "comments": "August close",
    "dateFormat": "dd MMMM yyyy",
    "locale": "en"
  }'
```

## Where to go next

- [Set up your ledger and post a journal entry](https://developer.lokta.ai/guides/accounting-setup/)
- [Provisioning and accruals reference](https://developer.lokta.ai/api/provisioning-accruals/)
