curl --request POST \
--url 'https://api.nixflex.com/v1/integrations/google-calendar/number/%2B12025550123/connect' \
--header "Authorization: Bearer $NIXFLEX_API_KEY" \
--header 'Content-Type: application/json' \
--data '{"return_url":"https://app.example.com/calendar/return"}'
const response = await fetch('https://api.nixflex.com/v1/integrations/google-calendar/number/%2B12025550123/connect', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.NIXFLEX_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({"return_url":"https://app.example.com/calendar/return"}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const result = await response.json();
// Handle the private result without logging it.
import os, json
from urllib.request import Request, urlopen
request = Request('https://api.nixflex.com/v1/integrations/google-calendar/number/%2B12025550123/connect', method='POST',
headers={'Authorization': 'Bearer ' + os.environ['NIXFLEX_API_KEY'], 'Content-Type': 'application/json'},
data="{\"return_url\":\"https://app.example.com/calendar/return\"}".encode("utf-8"))
with urlopen(request, timeout=30) as response:
result = json.load(response)
# Handle the private result without logging it.
$headers = @{ Authorization = "Bearer $env:NIXFLEX_API_KEY" }
$body = '{"return_url":"https://app.example.com/calendar/return"}'
$result = Invoke-RestMethod -Method POST -Uri 'https://api.nixflex.com/v1/integrations/google-calendar/number/%2B12025550123/connect' -Headers $headers -DisableKeepAlive -ContentType "application/json" -Body ([Text.Encoding]::UTF8.GetBytes($body))
# Handle $result privately.
{
"url": "https://accounts.google.com/o/oauth2/v2/auth?state=example",
"expires_at": "2030-11-04T10:10:00.000Z"
}
Google Calendar
Connect Google Calendar
Connect Google Calendar to an owned Nixflex number. Create a consent link, handle return codes and keep OAuth credentials private.
POST
/
integrations
/
google-calendar
/
number
/
{phoneNumber}
/
connect
curl --request POST \
--url 'https://api.nixflex.com/v1/integrations/google-calendar/number/%2B12025550123/connect' \
--header "Authorization: Bearer $NIXFLEX_API_KEY" \
--header 'Content-Type: application/json' \
--data '{"return_url":"https://app.example.com/calendar/return"}'
const response = await fetch('https://api.nixflex.com/v1/integrations/google-calendar/number/%2B12025550123/connect', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.NIXFLEX_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({"return_url":"https://app.example.com/calendar/return"}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const result = await response.json();
// Handle the private result without logging it.
import os, json
from urllib.request import Request, urlopen
request = Request('https://api.nixflex.com/v1/integrations/google-calendar/number/%2B12025550123/connect', method='POST',
headers={'Authorization': 'Bearer ' + os.environ['NIXFLEX_API_KEY'], 'Content-Type': 'application/json'},
data="{\"return_url\":\"https://app.example.com/calendar/return\"}".encode("utf-8"))
with urlopen(request, timeout=30) as response:
result = json.load(response)
# Handle the private result without logging it.
$headers = @{ Authorization = "Bearer $env:NIXFLEX_API_KEY" }
$body = '{"return_url":"https://app.example.com/calendar/return"}'
$result = Invoke-RestMethod -Method POST -Uri 'https://api.nixflex.com/v1/integrations/google-calendar/number/%2B12025550123/connect' -Headers $headers -DisableKeepAlive -ContentType "application/json" -Body ([Text.Encoding]::UTF8.GetBytes($body))
# Handle $result privately.
{
"url": "https://accounts.google.com/o/oauth2/v2/auth?state=example",
"expires_at": "2030-11-04T10:10:00.000Z"
}
FIXED · call For new Google Calendar or Cal.com voice bookings, collect spelled name and email separately. Finish the combined read-back and get a later clear yes before the write, even with require_booking_confirmation=false. To reschedule or cancel an existing Cal.com appointment that changed across lookups, read back the current target in full and get a fresh yes. Google Calendar skips this; its moves and cancels follow require_booking_confirmation. Confirm success only after the calendar write succeeds. SMS uses its own flow.
NOT OFFERED → do this instead · number The booking zone cannot change general call time. Set calcom_timezone_override on the number to an IANA zone, or null to inherit. Cal.com uses number → agent → saved connection → Europe/London. With a booking context, read effective_calcom_timezone and effective_calcom_timezone_source. Google Calendar keeps its own number-calendar setting.
YOU CAN CHANGE · number Supported Google Calendar settings include availability hours, timezone and invitation behaviour. These configure that number’s booking calendar.
Assign an agent first. A number can use one booking provider; a Cal.com connection conflicts with Google Calendar. Open the returned URL in the user’s browser to obtain consent. The link expires after ten minutes and can be used once. A saved connection that needs reconnect can request fresh consent; reconnect preserves business settings.
Use HTTPS for
Ordinary return URL query parameters are kept; reserved
The URL is short-lived and private. Do not log or cache it.
A Member dashboard session cannot connect. Read status after a lost response before creating another consent link.
timezone, hours, slot_minutes, calendar_id, send_invites.
SCOPE · number For an owned number assigned to an agent, send only return_url to start Google Calendar consent. Open the returned url for the calendar owner. A competing calendar is refused. Read the number’s status after consent to confirm connection.
Read the compact AI rules
Connect Google Calendar to an owned Nixflex number. Create a consent link, handle return codes and keep OAuth credentials private.
Method: POST ·
Success: 200 ·
Scope: Owning account
The important part
-
Your server can start the connection for one owned, assigned number. Send
return_urland open the returned consent URL for the calendar owner. A successful connect request starts consent. Read the number’s connection status after the redirect. - Open the returned consent link in the user’s browser; it expires after ten minutes.
- Consent connects one owned number. It does not confirm that any appointment was booked.
Authentication
UseAuthorization: Bearer KEY_ID:KEY_SECRET for the owning account. An organisation API key has Owner authority. Personal sessions use the role rules documented in Authentication; do not treat a Member session as an API key.
Request fields
| Field | Type | Required | Default and limits |
|---|---|---|---|
phoneNumber (path) | string | Yes | Owned E.164 number. URL-encode the leading +. |
| Field | Type | Required | Default | Limits and meaning |
|---|---|---|---|---|
return_url | string | Yes | Omitted | HTTPS return URL, or an app scheme that Nixflex support has approved for your organisation. No credentials, fragment, whitespace or OAuth-secret query parameters. At most 2048 characters |
return_url. Custom app schemes require Nixflex support to confirm you own the scheme and add it for your organisation; there is no public allowlist endpoint. Do not use credentials, fragments, whitespace, backslashes or OAuth-secret query names. The app receives status only, never OAuth codes or tokens.
| Redirect result | Meaning |
|---|---|
status=connected&phone_number=... | Connection saved for that number. |
status=error&code=access_denied | Consent was refused. |
status=error&code=expired_link | Link expired or the bound identity/revision changed. Start a new flow. |
status=error&code=already_connected | Existing connection or a booking-provider conflict. Read current state. |
status=error&code=google_error | Google connection could not complete. |
status, code, and phone_number values are replaced. Expired, replayed or missing state without a trusted destination shows a local 400 error instead of redirecting. A revoked app scheme also uses a local error. Never accept a return destination from callback query parameters.
Response fields
200 returns the following shape.
| Field | Type | Meaning |
|---|---|---|
url | string | Always returned. |
expires_at | string | Always returned. |
Example request
Production HTTP examples. Replace the placeholder identifiers with resources owned by the account. SetNIXFLEX_API_KEY privately; never print it.
curl --request POST \
--url 'https://api.nixflex.com/v1/integrations/google-calendar/number/%2B12025550123/connect' \
--header "Authorization: Bearer $NIXFLEX_API_KEY" \
--header 'Content-Type: application/json' \
--data '{"return_url":"https://app.example.com/calendar/return"}'
const response = await fetch('https://api.nixflex.com/v1/integrations/google-calendar/number/%2B12025550123/connect', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.NIXFLEX_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({"return_url":"https://app.example.com/calendar/return"}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const result = await response.json();
// Handle the private result without logging it.
import os, json
from urllib.request import Request, urlopen
request = Request('https://api.nixflex.com/v1/integrations/google-calendar/number/%2B12025550123/connect', method='POST',
headers={'Authorization': 'Bearer ' + os.environ['NIXFLEX_API_KEY'], 'Content-Type': 'application/json'},
data="{\"return_url\":\"https://app.example.com/calendar/return\"}".encode("utf-8"))
with urlopen(request, timeout=30) as response:
result = json.load(response)
# Handle the private result without logging it.
$headers = @{ Authorization = "Bearer $env:NIXFLEX_API_KEY" }
$body = '{"return_url":"https://app.example.com/calendar/return"}'
$result = Invoke-RestMethod -Method POST -Uri 'https://api.nixflex.com/v1/integrations/google-calendar/number/%2B12025550123/connect' -Headers $headers -DisableKeepAlive -ContentType "application/json" -Body ([Text.Encoding]::UTF8.GetBytes($body))
# Handle $result privately.
Example response
Illustrative response with placeholder identifiers.{
"url": "https://accounts.google.com/o/oauth2/v2/auth?state=example",
"expires_at": "2030-11-04T10:10:00.000Z"
}
Errors
Branch onerror.code, not the wording of error.message. The envelope includes type, code, message, doc_url and details.
| Status / code | What it means | What to do |
|---|---|---|
400 · invalid_return_url | The return destination is not allowed. | Use HTTPS or an approved app scheme; remove forbidden URL parts. |
401 · unauthorized | The credential is missing or invalid. | Check the full account credential and API host privately; stop the retry loop. |
403 · permission_denied | This actor cannot perform the operation. | Resolve the account or role restriction through an authorised person. |
403 · account_unavailable | The account is unavailable for this operation. | Resolve the account or role restriction through an authorised person. |
404 · number_not_found | The number is absent or inaccessible to this account. | Check the exact owned identifier and current resource state; do not probe another account. |
409 · already_connected | This number already has a calendar connection. | Read the connection status; do not create another consent flow for an already connected number. |
409 · booking_provider_conflict | Another booking provider is active. | Choose one provider and disconnect the unwanted connection deliberately. |
409 · agent_not_assigned | The number has no eligible agent. | Assign an eligible owned agent to this number before connecting the calendar. |
409 · expired_link | The consent or connection state is no longer current. | Start a fresh consent flow after checking the current connection. |
429 · rate_limit_exceeded | The request limit was reached. | Stop automatic retries; wait for the limit and reconcile state before a deliberate action. |
503 · calendar_unavailable | The calendar operation or status check could not be completed. | Treat the outcome as uncertain and read the affected resource before another deliberate change. |
503 · not_configured | The required service configuration is unavailable. | Contact Nixflex support: calendar connection is not set up on the service. |
503 · guard_unavailable | The access check could not be completed. | Wait for the access check to recover; do not bypass it. |
Retry and idempotency
Disable automatic write retries. A lost response leaves the result uncertain; read the affected resource before another deliberate action. No general Idempotency-Key replay guarantee applies. See retry rules.Related endpoints
Authorizations
Path Parameters
Body
application/json