Skip to main content

REST API: Common Errors and How to Fix Them

Troubleshooting guide for 422, 401, and 404 errors when using the StoreRocket REST API.

If you're using the StoreRocket REST API to manage locations programmatically, here are the most common errors you'll run into and how to fix them.

API access requires the Business plan. You can generate API tokens from your API Tokens page.

V2 API errors return JSON even without an Accept header. For a JSON request body, include Content-Type: application/json; Accept: application/json is recommended.

422 Unprocessable Entity

A 422 means StoreRocket understood your request but the data didn't pass validation. Common causes:

Hours format wrong

For time schedules, use 24-hour ranges such as 09:00-17:00, with comma-separated ranges for split shifts. Use closed for days the store is closed. Each weekday value must be a string or null.

Coming-soon locations do not need opening hours. Omit hours or send "hours": {} to leave hours unchanged. On a new location, this leaves the schedule unset. Use PATCH with "hours": null to remove an existing schedule.

A nonempty hours object in a POST or PUT request must include all seven days. With PATCH, you can send only the days that changed; omitted days retain their values. Send a weekday object, rather than [], and use recognized weekday keys.

Example hours object:

{
"monday": "09:00-17:00",
"tuesday": "09:00-17:00",
"wednesday": "09:00-17:00",
"thursday": "09:00-17:00",
"friday": "09:00-17:00",
"saturday": "closed",
"sunday": "closed"
}

Missing required fields

Include name and city when creating a location with POST or updating with PUT. With PATCH, you only need to send the fields that change. If you include name or city, it must not be empty or null. A street address is optional. Include the relevant address fields or valid coordinates so the location can be placed on the map.

Invalid field values

Latitude and longitude accept numbers and numeric strings, such as 41.31245 or "41.31245". Check their ranges: latitude must be between -90 and 90, and longitude between -180 and 180. Non-numeric values are rejected.

401 Unauthorized

Your API token is missing or invalid.

Fix: Include the Authorization: Bearer YOUR_TOKEN header in every request. For V2, generate a new token from the API Tokens page if needed. V1 uses a separate legacy token; new dashboard tokens do not authenticate V1. See V1 authentication for legacy access and recovery.

404 Not Found

The location or resource doesn't exist, or you're using the wrong endpoint.

Fix: Double check the URL and the location ID. Make sure you're using the correct API version (/api/ for the existing V1 routes, or /api/v2/).

429 Too Many Requests

You've hit the rate limit. Slow down your requests and add a small delay between API calls.

Location created but not showing on map

If you create a location via API and it doesn't appear on the map:

  1. Check geocoding: In V2, POST and PUT geocode synchronously when either coordinate is missing or zero. Address-related PATCH updates queue geocoding only when a coordinate is missing, so their immediate response may precede the result. PATCH preserves supplied zero coordinates. Legacy V1 PUT updates queue geocoding.

  2. Check visibility: Make sure the location's visible field is set to true (or 1).

  3. Check the address: If the address couldn't be geocoded, the location is automatically hidden. For POST or PUT, provide both nonzero lat/lng coordinates to avoid geocoding. PATCH also preserves valid zero coordinates.

Full address not updating after address change

The combined address returned by the API is address. Changing address components refreshes an automatically generated address or display_address. A custom combined address stays saved when omitted.

To regenerate address from the saved components, include "address": null in the PATCH request. An omitted street component stays saved, so update or clear every relevant component when the address changes.

If you supply new coordinates, those values are saved. If an address update leaves coordinates missing, StoreRocket geocodes the location. A PATCH that only changes unrelated fields, such as a phone number or opening hours, does not start geocoding.

API documentation

For the full API reference, check the REST API article or contact us on live chat for specific endpoint questions.

Questions? Message us on live chat.

Did this answer your question?