Endpoint
Authentication
This endpoint requires authentication via bearer token representing a valid user session managed by Supabase Auth (cookies).Testing Note: Due to the requirement for a live user session, this endpoint cannot be successfully tested directly using the ‘Send’ button in this documentation with a static token.To test:
- Call this endpoint from your web application after logging in.
- Use
curl
or a similar tool with a valid, current user JWT obtained from your browser’s session after logging in.
curl
, you need the JWT access token stored by Supabase Auth in your browser.
- Log in to your application normally in your browser.
- Open Developer Tools (usually F12).
- Go to the Application tab (it might be called Storage in Firefox).
- Under the Storage section, find Cookies and select your application’s domain (e.g.,
http://localhost:3000
orhttps://onlyautomator.com
). - Look for a cookie named similar to
sb-access-token
(the exact name might vary slightly based on Supabase configuration). - Copy the entire value of this cookie. This is your Bearer token.
- Use this copied value in the
Authorization: Bearer <your_copied_token>
header for yourcurl
or other API tool requests.
Request Headers
Bearer token for authentication. Format:
Bearer YOUR_JWT_TOKEN
Must be set to
application/json
Request Body
Unique identifier of the subscriber/fan
Two-letter ISO country code (ISO 3166-1 alpha-2)
Full name of the country
Region or state within the country (if available)
City within the country (if available)
Source of the country information. Possible values: “ip”, “profile”, “manual”, “guess”. Default: “manual”
Confidence score for the country detection (0.0 to 1.0, where 1.0 is highest confidence)
Response
Status of the request (
success
or error
)Location object that was created or updated
Unique identifier for the location record
Unique identifier of the subscriber/fan
Two-letter ISO country code
Full name of the country
Region or state within the country (if available)
City within the country (if available)
Source of the country information
Confidence score for the country detection
ISO timestamp of when the location record was created
ISO timestamp of when the location record was last updated
200 Success
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
Error Codes
Error Code | Description |
---|---|
validation_error | A required parameter is missing or invalid |
invalid_country_code | The provided country code is not a valid ISO 3166-1 alpha-2 code |
authentication_required | No valid authentication token provided |
permission_denied | Token lacks required permissions |
resource_not_found | Fan not found with the provided ID |
service_unavailable | The location service is temporarily unavailable |
Notes
- This endpoint is used by the CRM panel in the Chrome extension to track subscriber locations
- Location information helps creators customize content and marketing for different regions
- Country information can be automatically detected based on IP address, but manual updates provide higher accuracy
- If a location record for the same
fanId
already exists, it will be updated instead of creating a new record - Country codes must follow the ISO 3166-1 alpha-2 standard (two-letter codes)
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Headers
Bearer token for authentication (JWT)
Body
application/json
Unique identifier of the subscriber/fan
Example:
"12345"
Two-letter ISO country code (ISO 3166-1 alpha-2)
Example:
"US"
Full name of the country
Example:
"United States"
Region or state within the country (if available)
Example:
"California"
City within the country (if available)
Example:
"Los Angeles"
Source of the country information
Available options:
ip
, profile
, manual
, guess
Example:
"manual"
Confidence score for the country detection (0.0 to 1.0)
Example:
1