Welcome to the Acuity Scheduling
Developer Hub!



Here you'll find guides and documentation to help you start working with Acuity as quickly as possible, as well as support if you get stuck. Let's jump right in!


How To Schedule an Appointment with the Acuity Scheduling API

Booking through the API lets you take advantage of Acuity's powerful scheduling platform while creating a more integrated scheduling interface or more automated booking process. And it's as easy as 1-2-3:

  1. Set up Acuity's PHP SDK
  2. Fetch available times for a service
  3. Schedule the appointment

Once we've set up the SDK, we'll use a number of Acuity's APIs to fetch available times and schedule the appointment:

Set up the PHP SDK

To get started, you'll need your Acuity User ID and API Key. If you don't have an account, you can sign up with a free trial here!

Setting up Acuity's PHP SDK is super simple using composer. Just run the composer require command:

$ composer require acuityscheduling/acuityscheduling

Then in your PHP script require the composer autoloader and create a new instance of AcuityScheduling:

<?php

require('./vendor/autoload.php');

$acuity = new AcuityScheduling(array(
  'userId' => YOUR_USER_ID,
  'apiKey' => 'YOUR_API_KEY'
));

If you're not using Composer, you can get our SDK directly from Github and then manually require src/AcuityScheduling.php.

Fetch Availability

Before booking an appointment, we'll have to find an available time slot for it. Availability in Acuity can vary by calendar, date and even service (appointment type). At a minimum, we'll need the appointment type to find some available slots.

To find your available appointment types, make a request to `/appointment-types':

$types = $acuity->request('/appointment-types');

Once you have the ID of the service you'd like to fetch availability for, you can check which dates have some available slots using the /availability/dates endpoint:

$dates = $acuity->request('/availability/dates', array(
  'query' => array(
    'month' => '2016-04',
    'appointmentTypeID' => 5 
  ) 
));

Finally, get the time slots for one of the available dates:

$times = $acuity->request('/availability/times', array(
  'query' => array(
    'date' => '2016-04-26',
    'appointmentTypeID' => 5
  ) 
));

Schedule an Appointment

Once you have an available time slot, you'll be able to schedule an appointment. Creating an appointment has a few required client fields by default: firstName, lastName and email. You'll also need the appointmentTypeID and the available datetime time slot.

If your appointment type has any custom intake forms, you can set those as well using the fields attribute.

$appointment = $acuity->request('/appointments', array(
  'method' => 'POST',
  'data' => array(
    'firstName' => 'Bob',
    'lastName' => 'Burger',
    'email' => '[email protected]',
    'datetime' => '2016-04-26T19:00:00-0700',
    'appointmentTypeID' => 5,
    'fields' => array(
      array(
        'id' => 4,  // Field ID of my intake form address question
        'value' => '1600 Pennsylvania Avenue'
      )
    )
  )
));

That's it! Once a new appointment is in the system, we'll take care of the rest. Admin's can view it on the backend and we'll send out our automatic confirmation e-mails and perform any integrations such as Acuity's 2-way calendar syncing.

Find out more about Acuity Scheduling or our developer platform. Like this tutorial, or want to get in touch? E-mail us at [email protected]