Skip to content
Support

API recipes: ten common tasks in curl, JavaScript and PHP

Owner, AdminLast checked 25 November 20268 min readArticle ID: developers-api-recipes
On this page

Copy-paste curl, JavaScript and PHP for the ten most common API tasks: a token, jobs, contacts, visits, sync, payments, statuses and webhooks.

Ten requests you'll use most, ready to copy, each in three tabs: curl, JavaScript (fetch) and PHP (Guzzle). $SKEDULER_API is your Skeduler API address (ask Skeduler support if you don't have it), $CLIENT_ID and $CLIENT_SECRET are your app's, and $ACCESS_TOKEN comes from recipe 1.

In the JavaScript and PHP tabs, the same names in capitals are variables you set. Replace the other capitals, such as JOB_ID, with your own values. Nothing here is a real key. Each recipe names the scope your app needs.

1. Get an access token

Swap your app's client id and secret for a token that lasts an hour. No scope needed.

curl

curl -s -X POST "$SKEDULER_API/api/v1/oauth/token" \
  -u "$CLIENT_ID:$CLIENT_SECRET" \
  -d grant_type=client_credentials

Use the access_token from the answer as ACCESS_TOKEN. See Get and use an access token.

2. List jobs

Scope: read:jobs.

curl

curl -s "$SKEDULER_API/api/v1/jobs?per_page=25&page=1" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

See Offset paging for lists.

3. Find a contact by email

Scope: read:contacts. Do this before you create one, so you don't make a duplicate.

curl

curl -s "$SKEDULER_API/api/v1/contacts?email=sam@example.com" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

4. Create a contact (a customer)

Scope: write:contacts. A contact's id is the customer_id a job takes.

curl

curl -s -X POST "$SKEDULER_API/api/v1/contacts" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: A_NEW_UNIQUE_KEY" \
  -d '{"first_name":"Sam","last_name":"Taylor","email":"sam@example.com","mobile_phone":"0400 000 000"}'

See Customers or contacts, which endpoint do I use?.

5. Create a job

Scope: write:jobs. Only title is required.

curl

curl -s -X POST "$SKEDULER_API/api/v1/jobs" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: A_NEW_UNIQUE_KEY" \
  -d '{"title":"Hot water system repair","customer_id":"CONTACT_ID","address_line_1":"12 Example Street","city":"Brisbane","state":"QLD","postal_code":"4000"}'

6. Book a visit on a job

Scope: write:visits. job_id, start_at and end_at are required. Find a technician_id with GET /technicians. Send "dispatch": true when the technician should see the visit now: it defaults to false, and a visit that isn't dispatched stays off their phone. See My technician can't see a visit I booked.

curl

curl -s -X POST "$SKEDULER_API/api/v1/visits" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: A_NEW_UNIQUE_KEY" \
  -d '{"job_id":"JOB_ID","technician_id":"TECHNICIAN_ID","start_at":"2026-11-03T01:00:00+00:00","end_at":"2026-11-03T03:00:00+00:00","dispatch":true}'

See Create a job and book a visit from your own system.

7. Sync what changed since a date

Scope: read:jobs (the same works on the other lists). The first call takes updated_since. Each answer has a meta.next_cursor: send it as cursor next time.

curl

curl -s "$SKEDULER_API/api/v1/jobs?updated_since=2026-11-01T00:00:00Z" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

curl -s "$SKEDULER_API/api/v1/jobs?cursor=NEXT_CURSOR" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

See Keep your system in sync with sync mode and cursors.

8. Record a payment on an invoice

Scope: write:payments. The Idempotency-Key header is required here. Money is in cents.

curl

curl -s -X POST "$SKEDULER_API/api/v1/invoices/INVOICE_ID/payments" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: A_NEW_UNIQUE_KEY" \
  -d '{"amount_cents":15000,"method":"bank_transfer","paid_on":"2026-11-03"}'

See Record a payment on an invoice.

9. Change a job's status

Scope: write:jobs. Send the name of one of your business's job statuses.

curl

curl -s -X PATCH "$SKEDULER_API/api/v1/jobs/JOB_ID/status" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: A_NEW_UNIQUE_KEY" \
  -d '{"status":"Completed"}'

See Change a job's status.

10. Subscribe to a webhook

Scope: the event's read scope, such as read:jobs for job.created; without it the call answers 403 insufficient_scope. Skeduler posts to your target_url each time the event happens. Keep the signing_secret from the answer to check each delivery.

curl

curl -s -X POST "$SKEDULER_API/api/v1/webhooks/subscriptions" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: A_NEW_UNIQUE_KEY" \
  -d '{"event":"job.created","target_url":"https://example.com/skeduler/webhook"}'

To handle a delivery, check its signature first. See Verify webhook signatures.

Use a new key for each write

A_NEW_UNIQUE_KEY stands for a fresh value, such as a random UUID, for each write. Send the same one again only when you retry that same request. See Safe retries with idempotency keys.

In this section