FansquareAPI reference
Open the app

Get started

Errors

Errors follow RFC 7807. Branch on the stable type of each error, never on its title.

An error answers with an HTTP status in the 4xx or 5xx range and a body in the Problem Details format (RFC 7807), served as application/problem+json.

JSON
{
  "type": "https://developers.offmy.co/errors/missing_scope",
  "title": "Missing scope",
  "status": 403,
  "detail": "This API key does not have the required scope.",
  "instance": "/v1/orders?limit=50",
  "required_scope": "read:orders"
}
FieldMeaning
typeStable URI of the error. Its last segment is the slug listed below. Branch on it.
titleShort summary. Two errors of the same type can have different titles.
statusThe HTTP status, repeated.
detailWhat happened this time, when there is more to say.
instancePath and query of the request that failed.

Some errors add members of their own (required_scope, supported_versions, errors…), described with each error below. Ignore the members you do not know.

Resources outside the reach of your key (another agency, or a creator the key does not cover) answer 404, exactly like resources that do not exist.

Every response, error or not, carries an x-request-id header. It repeats the x-request-id of your request when you send one. Quote it when you contact support.

Authentication

missing_authorization

401. No Authorization: Bearer … header. Send your API key, see Authentication.

invalid_api_key

401. The key is malformed, unknown or revoked. Check that the full key was copied, then create a new one if it was revoked.

expired_api_key

401. The key passed the expiration date chosen at its creation. Create a new key.

missing_scope

403. The key does not have the scope this endpoint needs, given in required_scope. Create a key with that scope.

Version

missing_version

400. The Fansquare-Version header is missing. The error gives current_version, current_version_date and a ready header in example. See Versioning.

unknown_version

400. The Fansquare-Version value is not a released version. supported_versions lists the valid ones.

Request

validation_failed

400. A parameter or the body is invalid: wrong type, value out of range, unknown query parameter on an endpoint that takes query parameters, inconsistent date range, or a body that is not valid JSON.

When the request does not match the schema of the endpoint, errors lists each problem. Read two members of each item:

  • path: where the problem is, in the query or the body, with dots between levels (limit, enabled_event_types.0). It is empty when the problem concerns the whole query or body, such as an unknown parameter.

  • message: what is wrong. Ignore the other members of each item.

detail sums up the same problems in one sentence, each as path: message (timezone: Invalid IANA timezone; limit: Number must be less than or equal to 200), to show or log as is. The other validation_failed errors, such as an inconsistent date range or a body that is not valid JSON, have no errors: detail explains the problem.

payload_too_large

413. The request body is over 256 KB (1 MB on Update the insight notes of fans in bulk). Send less data per request.

unsupported_media_type

415. The body is not sent as JSON. Set Content-Type: application/json. An empty body with that header is accepted on endpoints that take no body.

invalid_cursor

400. The cursor was altered or was not issued by the API. Read it from the previous page, see Pagination.

precondition_required

428. Editing a fan note requires the concurrency token read with it, in the etag body field or the If-Match header. See Update the insight note of a fan.

precondition_failed

412. The fan note changed since you read it. When the current token is known, it is in current_etag: retry with it, or read the note again and retry with the fresh token.

Not found

not_found

404. No endpoint at this path. Check the method and the path, including the /v1 prefix. The version header and the API key are checked first: without them, an unknown path answers 400 or 401, not 404.

unknown_account

404. No connected MYM account with this account_id within the reach of your key. Take the id from account.external_id in List creators.

unknown_fan

404. No fan with this fan_id on this account. The writes (assignment, AI lock, tag) never create a fan: a fan becomes known once Fansquare has synced it from MYM. The batch writes skip unknown fans and list them in unknown_fan_ids instead.

unknown_order

404. No order with this id within the reach of your key.

unknown_creator

404. No creator with this id within the reach of your key.

unknown_user

422. The employee given in the body is not a member of the agency. List them with List employees.

unknown_tag

422. One or more tag ids do not match a tag of the agency. They are listed in tag_ids; the catalogue comes from List tags.

tag_name_taken

409. The agency already has a tag with this name. Pick another name, or reuse the existing tag from List tags.

tag_limit_reached

422. The fan already carries 5 tags, the most a fan can carry, as in the app. Remove one of its tags before adding this one. Applying a tag to many fans at once leaves those fans untouched and lists them in tag_limit_fan_ids.

unknown_publication

404. No publication with this id within the reach of your key.

unknown_mass_dm

404. No Mass DM with this id within the reach of your key.

unknown_automation

404. No automation with this id within the reach of your key.

unknown_media

404. A media of the messages does not exist or is not in the creator's MYM vault. media_ids are MYM media uuids of that creator.

unknown_script_collection

404. No script collection with this id within the reach of your key. A script can only move to a collection of its own creator.

unknown_script

404. No script with this id within the reach of your key.

unknown_script_sequence

404. No script sequence with this id within the reach of your key.

unknown_shift

404. No shift with this id within the reach of your key. A key limited to some creators only reaches their shifts.

unknown_absence

404. No absence with this id in the agency.

unknown_employee

404. An employee id is not an active member of the agency. Use the ids of GET /v1/planning/team or GET /v1/employees.

unknown_named_shift

404. No named shift with this id in the agency. Use the ids of GET /v1/named-shifts.

unknown_webhook_endpoint

404. No webhook endpoint with this id within the reach of your key. A key limited to some creators only reaches the endpoints that cover its own creators and no other.

unknown_webhook_failure

404. No failed delivery with this id on this endpoint. Failures are kept 30 days.

Mass DMs and automations

mass_dm_burst_limit

409. The creator already has 5 Mass DMs leaving within 15 minutes of this one, whoever created them. They are listed in conflicting_mass_dms (id, send_at). Pick another time, or cancel one of them. See Mass DMs and automations.

mass_dm_daily_limit

409. The creator would have more than 10 Mass DMs leaving within 24 hours, whoever created them. The limit is per creator. The limit counts send dates, not creations. The Mass DMs of the busiest 24 hours are listed in conflicting_mass_dms, between window_start and window_end. Pick another date, or cancel one of them.

mass_dm_already_sent

409. The Mass DM has already been sent: it stays in the history as sent and can no longer be cancelled.

automation_trigger_taken

409. Another active automation of the creator already sends a message on this trigger, given in automation_id. It is never paused for you: pause it first, or create the new one with active: false.

automation_not_resumable

409. Only a paused automation can be resumed. A draft (never turned on) or an archived automation is turned on from the app, and a cancelled one is over: create a new one.

automation_not_pausable

409. Only an active automation can be paused: a draft never fires, a cancelled one is over. Pausing an automation that is already paused is a no-op.

Scripts and sequences

script_sequence_invalid

422. Some fields of the sequence tree are refused, and nothing was written. Each one is listed in errors, with its path (steps.1.options.0.script_id), a problem code and a message: script_not_found (not a script of this creator), step_not_in_sequence and option_not_in_step (an id that is not of this sequence), duplicate_id, label_required (an other option without label), condition_on_first_step (the first step only takes any), collection_empty and collection_too_large (a collection of more than 30 scripts). Fix them and send the whole tree again. See Scripts and sequences.

script_media_unresolved

409. A media of this script is stored under a former MYM id that the API cannot turn into a media uuid, so messages cannot replace its messages without losing it. Edit the messages in the Fansquare app. The name, note, order and collection of the script can still be changed through the API.

Team planning

shift_day_not_found

422. The shift has no occurrence on that day. Pass the occurrence_date of the item read on GET /v1/shifts.

absence_already_declared

409. The employee already has an absence that day. Change it with PATCH /v1/absences/{absence_id}.

shift_series_started

409. The series started before today, and its past is never rewritten: only its end changes. To change it from a day on, end it from that day (DELETE with the scope following), then create the new shift from that day.

planning_day_in_past

409. The day is before today. The planning changes from today on: a past day is never written, changed or removed, and a series never ends before today. Use today or a later day.

absence_needs_all_creators

403. The key is limited to some creators. An absence affects every creator the employee works on, since its replacement takes all their shifts that day: declare, change or remove it with a key for all creators. The key can still read the absences.

Webhooks

undeliverable_url

422. The endpoint URL must use HTTPS and point to a public host: no localhost, private network ranges, .internal or .local names.

webhook_endpoint_limit

422. The agency already has 10 webhook endpoints, the maximum. Delete one first.

webhook_endpoint_disabled

409. The endpoint is disabled, by you or after repeated failures. Re-enable it with status: "active" before sending a test delivery.

Limits and availability

rate_limited

429. Too many requests for this key. Wait the number of seconds given in the Retry-After header. See Rate limits.

internal_error

500. An error on our side. The body carries a request_id, the value of the x-request-id header: give it to support if the error persists.

unavailable

503. A service the request depends on is temporarily unavailable. Retry after a short delay.

Retry a request

A 429, a 5xx or a timeout can be retried. Before you retry a write, check what a repeat does:

  • PUT and DELETE can be repeated: the result is the same. A DELETE repeated on a publication or a webhook endpoint answers 404, the resource being already gone.

  • POST /v1/publications and POST /v1/webhooks create a new resource on every call. After a timeout, list the resources first: a blind retry can create a duplicate.

The API does not support an Idempotency-Key header.