# ARI api-docs returns 500 "Cannot find rest-api directory" on VitalPBX (Asterisk 20) – Fix with symlink

**URL:** https://forums.vitalpbx.org/t/ari-api-docs-returns-500-cannot-find-rest-api-directory-on-vitalpbx-asterisk-20-fix-with-symlink/5987
**Category:** VitalPBX 4
**Created:** [January 22, 2026, 7:45pm UTC](https://forums.vitalpbx.org/t/ari-api-docs-returns-500-cannot-find-rest-api-directory-on-vitalpbx-asterisk-20-fix-with-symlink/5987 "2026-01-22T19:45:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![lucas\_mota](https://forums.vitalpbx.org/user_avatar/forums.vitalpbx.org/lucas_mota/32/4423_2.png) [@lucas\_mota](https://forums.vitalpbx.org/u/lucas_mota)
#### Post date: [January 22, 2026, 7:45pm UTC](https://forums.vitalpbx.org/t/ari-api-docs-returns-500-cannot-find-rest-api-directory-on-vitalpbx-asterisk-20-fix-with-symlink/5987/1 "2026-01-22T19:45:01Z")

</div>

## Problem

When accessing the ARI Swagger documentation endpoint:

```auto

http://<PBX_IP>:8088/ari/api-docs/resources.json

```

the server returns **HTTP 500** with the message:

```json
{
  "message": "Cannot find rest-api directory"
}

```

Even though:

- ARI is enabled
- HTTP server is running
- `/usr/share/asterisk/rest-api/*.json` exists
- File permissions are correct

The Asterisk log shows:

```auto
res_ari.c: Error determining real directory for rest-api

```

## Root Cause

On **VitalPBX** , the internal Asterisk setting `AST_DATA_DIR` points to:

```auto
/var/lib/asterisk

```

The ARI documentation handler always looks for the Swagger JSON files in:

```auto
${AST_DATA_DIR}/rest-api

```

However, the `rest-api` JSON files are installed by the package in:

```auto
/usr/share/asterisk/rest-api

```

Because of this mismatch, ARI fails to resolve the directory at runtime, even though the files exist and have correct permissions.

This affects **only the Swagger / api-docs endpoint**.  
The ARI REST API itself (`/ari/channels`, `/ari/events`, etc.) works normally.

## Solution (Recommended)

Create a symbolic link so that the directory exists where Asterisk expects it:

```bash
# ensure it does not already exist
sudo ls -ld /var/lib/asterisk/rest-api

# create symlink
sudo ln -s /usr/share/asterisk/rest-api /var/lib/asterisk/rest-api

# ensure ownership is correct
sudo chown -h asterisk:asterisk /var/lib/asterisk/rest-api

# restart asterisk
sudo systemctl restart asterisk

```

After this, the following endpoint works correctly:

```auto
http://<PBX_IP>:8088/ari/api-docs/resources.json

```

## Why this fix is safe

- No Asterisk configuration files are modified
- No paths are changed globally
- Avoids changing `astdatadir` in `asterisk.conf`, which could break other components
- Fully compatible with VitalPBX package layout

## Environment

- VitalPBX
- Asterisk 20.15.0
- Debian-based system

## Notes

If you don’t need the Swagger docs, this issue can be ignored, as it does **not** affect ARI functionality itself.  
This fix is only required if you want `/ari/api-docs/*` to work.

Hope this helps others facing the same issue.
