PHPackages                             uxicodev/unifi-access-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. uxicodev/unifi-access-api

ActiveLibrary[API Development](/categories/api)

uxicodev/unifi-access-api
=========================

An API client for the Ubiquiti Unifi Access API

1.1.1(6mo ago)522[1 PRs](https://github.com/uxico-dev/unifi-access-api/pulls)MITPHPPHP ^8.2CI passing

Since Oct 18Pushed 6mo agoCompare

[ Source](https://github.com/uxico-dev/unifi-access-api)[ Packagist](https://packagist.org/packages/uxicodev/unifi-access-api)[ Docs](https://github.com/uxicodev/unifi-access-api)[ RSS](/packages/uxicodev-unifi-access-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (6)Used By (0)

A PHP (Laravel) API client for the Ubiquiti Unifi Access API
============================================================

[](#a-php-laravel-api-client-for-the-ubiquiti-unifi-access-api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/86e84e72a50a1cf1a40f9b0ae23ac47a61466dc458970b92e8a18be0b5ab401d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f757869636f6465762f756e6966692d6163636573732d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/uxicodev/unifi-access-api)[![Total Downloads](https://camo.githubusercontent.com/01a815a2c25fb120956b9ddd1ef16d4eb888d8f5d183c96eaf8d6159ea1cbe82/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f757869636f6465762f756e6966692d6163636573732d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/uxicodev/unifi-access-api)[![Github Actions](https://github.com/uxico-dev/unifi-access-api/actions/workflows/main.yml/badge.svg)](https://github.com/uxico-dev/unifi-access-api/actions/workflows/main.yml)[![codecov](https://camo.githubusercontent.com/0b1f29379c76953f6347e195fa265674aa3ba63db4191590501611894c10b531/68747470733a2f2f636f6465636f762e696f2f67682f757869636f2d6465762f756e6966692d6163636573732d6170692f67726170682f62616467652e7376673f746f6b656e3d5936385952374b4b3231)](https://codecov.io/gh/uxico-dev/unifi-access-api)[![Static Badge](https://camo.githubusercontent.com/4dd166f3abc6d7e5a3a77b06791792be2402161a0ce04ba756425643b868507c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6576656c253230382532302d2532307068707374616e3f6c6f676f3d706870266c6162656c3d5048505374616e26636f6c6f723d6461726b626c7565)](https://camo.githubusercontent.com/4dd166f3abc6d7e5a3a77b06791792be2402161a0ce04ba756425643b868507c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6576656c253230382532302d2532307068707374616e3f6c6f676f3d706870266c6162656c3d5048505374616e26636f6c6f723d6461726b626c7565)

A GuzzleHTTP client that can communicate with the Ubiquiti Unifi Access API. Ready to use with Laravel, but can also be used with other frameworks or plain PHP. Currently the following Unifi Access resources have been (partially) implemented:

- Visitor
- Credential
- DoorGroups
- System

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require uxicodev/unifi-access-api
```

Usage
-----

[](#usage)

The Unifi Access API exposes several resources. The resources are represented by different Client classes. All resources can be accessed through the `UnifiAccessApi\Client\Client` class.

All responses are represented by Data Transfer Objects (DTOs) that can be found in the `Uxicodev\UnifiAccessApi\API\Responses` namespace. The objects returned are Entities that can be found in the `Uxicodev\UnifiAccessApi\API\Entities` namespace.

### Laravel

[](#laravel)

Add the following to your `.env` file:

```
## Replace with your actual Unifi Access controller URL
UNIFI_ACCESS_URI="https://192.168.1.1:12445/api/v1/developer/"
#API key can be retrieved in your admin console at page "access/settings/system"
UNIFI_ACCESS_API_KEY="your_api_key_here"
UNIFI_ACCESS_SSL_VERIFY=false
```

```
use Carbon\Carbon;
use GuzzleHttp\Client as GuzzleHttpClient;
use Uxicodev\UnifiAccessApi\API\Enums\VisitReason;
use Uxicodev\UnifiAccessApi\API\Requests\Visitor\UpsertVisitorRequest;
use Uxicodev\UnifiAccessApi\UnifiAccessApiFacade;

$unifiClient = UnifiAccessApiFacade::getClient();
$visitorRequest = new UpsertVisitorRequest('Jimmy', 'McGill', Carbon::now(), Carbon::now()->addHour(), VisitReason::Others);
$visitorResponse = $unifiClient->visitor()->create($visitorRequest);
$unifiClient->visitor()->assignQrCode($visitorResponse->data->id);
$tmpFile = $unifiClient->credential()->downloadQrCode($visitorResponse->data->id);
```

### Non-Laravel application

[](#non-laravel-application)

```
use Carbon\Carbon;
use Uxicodev\UnifiAccessApi\API\Enums\VisitReason;
use Uxicodev\UnifiAccessApi\API\Requests\Visitor\UpsertVisitorRequest;
use Uxicodev\UnifiAccessApi\Client\Client as UnifiClient;
use GuzzleHttp\Client as GuzzleHttpClient;

$baseUri = 'https://192.168.1.1:12445/api/v1/developer/';
$apiKey = 'your_api_key_here';

$guzzleClient = new GuzzleHttpClient([
    'base_uri' => $baseUri,
    'headers' => [
        'Authorization' => $apiKey,
        'Accept' => 'application/json',
    ],
    'verify' => false,
]);

$unifiClient = new UnifiClient($guzzleClient);
$visitorRequest = new UpsertVisitorRequest('Jimmy', 'McGill', Carbon::now(), Carbon::now()->addHour(), VisitReason::Others);
$visitorResponse = $unifiClient->visitor()->create($visitorRequest);
$unifiClient->visitor()->assignQrCode($visitorResponse->data->id);
$tmpFile = $unifiClient->credential()->downloadQrCode($visitorResponse->data->id);
```

FAQ
---

[](#faq)

### My API key is not working

[](#my-api-key-is-not-working)

Make sure you are using the correct API key. You can create an API key at two seperate locations, but those locations serve a different purpose. You can retrieve the Access API key in your admin console at page `access/settings/system`.

You can also create a Network/Protect API key at `access/settings/control-plane/integrations`. However, this key does NOT work for the Access API.

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Maarten Kuiper](https://github.com/uxicodev)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance66

Regular maintenance activity

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

4

Last Release

207d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a5d517f8ada3967b001394a63b734357f85d0517c05905e3c89d005ee852d015?d=identicon)[maarten00](/maintainers/maarten00)

---

Top Contributors

[![maarten00](https://avatars.githubusercontent.com/u/1579711?v=4)](https://github.com/maarten00 "maarten00 (56 commits)")

---

Tags

apilaravelaccessunifiubiquiti

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/uxicodev-unifi-access-api/health.svg)

```
[![Health](https://phpackages.com/badges/uxicodev-unifi-access-api/health.svg)](https://phpackages.com/packages/uxicodev-unifi-access-api)
```

###  Alternatives

[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[ardakilic/mutlucell

Mutlucell SMS API wrapper for sending sms text messages for Laravel

457.3k](/packages/ardakilic-mutlucell)[dariusiii/tmdb-laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the wtfzdotnet/php-tmdb-api library.

1821.1k](/packages/dariusiii-tmdb-laravel)[gufy/whmcs

WHMCS API for Laravel 5

201.7k](/packages/gufy-whmcs)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
