Skip to content
Docs menu

Copy the text

Your browser did not allow copying. The text below is selected: press Ctrl+C, or ⌘C on a Mac.

Register a device

Registers the APNs token of this device. Registering the same token again updates it. File names stay out of notifications unless show_file_names is true.

POSThttps://api.switchfile.io/v1/account/devices

Needs an API key: Authorization: Bearer YOUR_API_KEY. See Authentication.

Example

curl "https://api.switchfile.io/v1/account/devices" \
  -H "Authorization: Bearer $SWITCHFILE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "token": "a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90",
    "environment": "production",
    "locale": "de"
  }'

Request body

  • environmentstringrequired

    one of "production", "sandbox"

  • localestring

    Language of the texts, for example de or en-US

    matches ^[a-zA-Z]{2}([-_][a-zA-Z0-9]{2,8})?$

  • notify_failedboolean
  • notify_finishedboolean
  • show_file_namesboolean

    Show the file name in notifications. Default false

  • start_tokenstring | null

    APNs token as hex

    matches ^[0-9a-fA-F]{32,200}$

  • tokenstringrequired

    APNs token as hex

    matches ^[0-9a-fA-F]{32,200}$

Responses

  • 200OK
    • created_atstringrequired

      ISO 8601 timestamp

    • environmentstringrequired

      one of "production", "sandbox"

    • idstring (uuid)required
    • live_activity_startbooleanrequired

      A push-to-start token is registered

    • localestringrequired
    • notify_failedbooleanrequired
    • notify_finishedbooleanrequired
    • show_file_namesbooleanrequired
    • updated_atstringrequired

      ISO 8601 timestamp

    200 application/json
    {
      "id": "b3e1f2a4-5c6d-4e7f-8a9b-0c1d2e3f4a5b",
      "environment": "production",
      "locale": "de",
      "notify_finished": true,
      "notify_failed": true,
      "show_file_names": false,
      "live_activity_start": false,
      "created_at": "2026-11-06T18:00:00+00:00",
      "updated_at": "2026-11-06T18:00:00+00:00"
    }
  • 401The API key is missing or not valid
    401 application/problem+json
    {
      "type": "https://switchfile.io/docs/api/v1#errors-unauthenticated",
      "title": "Unauthenticated",
      "status": 401,
      "code": "UNAUTHENTICATED",
      "detail": "Missing or invalid API key."
    }
  • 403Not available with a service key or a connected app
    403 application/problem+json
    {
      "type": "https://switchfile.io/docs/api/v1#errors-not-available",
      "title": "Not available",
      "status": 403,
      "code": "NOT_AVAILABLE",
      "detail": "This endpoint is only available with your own API key or the switchfile app."
    }
  • 404Does not exist for this account
    404 application/problem+json
    {
      "type": "https://switchfile.io/docs/api/v1#errors-not-found",
      "title": "Not found",
      "status": 404,
      "code": "NOT_FOUND",
      "detail": "Not found."
    }
  • 422Invalid data. errors names the fields
    422 application/problem+json
    {
      "type": "https://switchfile.io/docs/api/v1#errors-invalid-data",
      "title": "Invalid data",
      "status": 422,
      "code": "INVALID_DATA",
      "detail": "The request contains invalid data.",
      "errors": {
        "to": [
          "Expected string"
        ]
      }
    }
  • 429Too many requests or a daily quota is used up. See Retry-After
    429 application/problem+json
    {
      "type": "https://switchfile.io/docs/api/v1#errors-rate-limit-exceeded",
      "title": "Rate limit exceeded",
      "status": 429,
      "code": "RATE_LIMIT_EXCEEDED",
      "detail": "Too many requests. Try again in 12 seconds."
    }

Error bodies and codes are explained in Errors.