Skip to main content
GET
/
api
/
v2
/
get-preferences
Get Preferences
curl --request GET \
  --url https://onlyautomator.com/api/v2/get-preferences \
  --header 'Authorization: Bearer <token>'
{
  "status": "success",
  "data": [
    {
      "id": "pref_1c2d3e4f-5678-9012-ijkl-456789abcdef",
      "fanId": "fan_uuid_12345",
      "userId": "user_uuid_abcdef",
      "category": "content",
      "preference": "likes_fitness_videos",
      "value": true,
      "source": "manual",
      "createdAt": "2023-03-15T14:23:45Z",
      "updatedAt": "2023-03-15T14:23:45Z"
    },
    {
      "id": "pref_2d3e4f5g-5678-9012-ijkl-456789abcdef",
      "fanId": "fan_uuid_12345",
      "userId": "user_uuid_abcdef",
      "category": "messaging",
      "preference": "prefers_voice_messages",
      "value": true,
      "source": "inferred",
      "createdAt": "2023-03-14T12:10:30Z",
      "updatedAt": "2023-03-14T12:10:30Z"
    },
    {
      "id": "pref_3e4f5g6h-5678-9012-ijkl-456789abcdef",
      "fanId": "12345",
      "category": "scheduling",
      "preference": "active_weekends",
      "value": true,
      "createdAt": "2023-03-13T18:45:15Z",
      "updatedAt": "2023-03-13T18:45:15Z"
    }
  ]
}
Retrieves all preferences associated with a specific subscriber in the OnlyAutomator CRM system.

Endpoint

GET /api/v2/get-preferences

Authentication

This endpoint requires authentication using a valid JWT token representing a valid user session managed by Supabase Auth (cookies).Include the token in the Authorization header as a Bearer token:
Authorization: Bearer <your_jwt_token>
The JWT token is obtained when connecting the account through the extension, or automatically handled by the browser session.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:
  1. Call this endpoint from your web application after logging in.
  2. Use curl or a similar tool with a valid, current user JWT obtained from your browser’s session after logging in.
Retrieving JWT Token for Testing: To test endpoints requiring a user session with tools like curl, you need the JWT access token stored by Supabase Auth in your browser.
  1. Log in to your application normally in your browser.
  2. Open Developer Tools (usually F12).
  3. Go to the Application tab (it might be called Storage in Firefox).
  4. Under the Storage section, find Cookies and select your application’s domain (e.g., http://localhost:3000 or https://onlyautomator.com).
  5. Look for a cookie named similar to sb-access-token (the exact name might vary slightly based on Supabase configuration).
  6. Copy the entire value of this cookie. This is your Bearer token.
  7. Use this copied value in the Authorization: Bearer <your_copied_token> header for your curl or other API tool requests.
Note: This token has a limited lifetime and you’ll need to copy a fresh one after it expires.

Request Headers

Authorization
string
required
Bearer token for authentication. Format: Bearer YOUR_JWT_TOKEN
Content-Type
string
required
Must be set to application/json

Query Parameters

fanId
string
required
Unique identifier of the subscriber/fan whose preferences should be retrieved
category
string
Optional filter to retrieve only preferences of a specific category

Responses

This section outlines the successful response format and common error responses.

200 OK - Successful Response

{
  "status": "success",
  "data": [
    {
      "id": "pref_1c2d3e4f-5678-9012-ijkl-456789abcdef",
      "fanId": "fan_uuid_12345",
      "userId": "user_uuid_abcdef",
      "category": "content",
      "preference": "likes_fitness_videos",
      "value": true,
      "source": "manual",
      "createdAt": "2023-03-15T14:23:45Z",
      "updatedAt": "2023-03-15T14:23:45Z"
    },
    {
      "id": "pref_2d3e4f5g-5678-9012-ijkl-456789abcdef",
      "fanId": "fan_uuid_12345",
      "userId": "user_uuid_abcdef",
      "category": "messaging",
      "preference": "prefers_voice_messages",
      "value": true,
      "source": "inferred",
      "createdAt": "2023-03-14T12:10:30Z",
      "updatedAt": "2023-03-14T12:10:30Z"
    },
    {
      "id": "pref_3e4f5g6h-5678-9012-ijkl-456789abcdef",
      "fanId": "12345",
      "category": "scheduling",
      "preference": "active_weekends",
      "value": true,
      "createdAt": "2023-03-13T18:45:15Z",
      "updatedAt": "2023-03-13T18:45:15Z"
    }
  ]
}
Detailed structure of the preference objects within the data array:
data[].id
string
Unique identifier for the preference record (UUID).
data[].fanId
string
Unique identifier of the subscriber/fan this preference belongs to.
data[].userId
string
Unique identifier of the OnlyAutomator user who set or owns this preference record.
data[].category
string
Category of the preference (e.g., “content”, “messaging”).
data[].preference
string
Specific preference identifier or key (e.g., “likes_fitness_videos”).
data[].value
any
Value of the preference (can be boolean, string, number, etc.).
data[].source
string
Source of the preference (e.g., “manual”, “inferred”, “survey”, nullable).
data[].createdAt
string
ISO timestamp of when the preference record was created.
data[].updatedAt
string
ISO timestamp of when the preference record was last updated (nullable).

Error Responses

{
  "status": "error",
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "The 'fanId' parameter is required and must be a non-empty string.",
    "details": {
      "fanId": "Required field missing or invalid format"
    } 
  }
}
{
  "status": "error",
  "error": {
    "code": "UNAUTHENTICATED",
    "message": "Authentication is required and has failed or has not yet been provided."
  }
}
{
  "status": "error",
  "error": {
    "code": "FORBIDDEN",
    "message": "You do not have permission to access preferences for this fan."
  }
}
{
  "status": "error",
  "error": {
    "code": "NOT_FOUND",
    "message": "Fan not found with the provided ID: 'some_fan_id'."
  }
}
{
  "status": "error",
  "error": {
    "code": "INTERNAL_SERVER_ERROR",
    "message": "An unexpected error occurred on the server. Please try again later."
  }
}

Error Codes

Error CodeDescription
validation_errorA required parameter is missing or invalid
authentication_requiredNo valid authentication token provided
permission_deniedToken lacks required permissions
resource_not_foundFan not found with the provided ID
service_unavailableThe preference service is temporarily unavailable

Common Preference Categories

CategoryDescriptionExample Preferences
contentContent preferenceslikes_fitness, prefers_photos, enjoys_long_videos
messagingMessaging preferencesprefers_voice_messages, responds_to_text, morning_messages
tippingTipping behaviorfrequent_tipper, high_value_tipper, special_occasion_tipper
schedulingTiming preferencesactive_weekends, evening_chatter, timezone_gmt_minus_8

Notes

  1. This endpoint is used by the CRM panel in the Chrome extension to display subscriber preferences
  2. When filtering by category, use the exact category name (case-sensitive)
  3. If no preferences are found for the subscriber, an empty array is returned
  4. The response is ordered by creation date, with the most recently created preferences first
  5. Preferences help creators customize their content and interactions for each subscriber

Authorizations

Authorization
string
header
required

Standard user JWT token for authentication.

Headers

Authorization
string
required

Bearer token for authentication (JWT)

Query Parameters

fanId
string
required

Unique identifier of the subscriber/fan whose preferences should be retrieved

category
string

Optional filter to retrieve only preferences of a specific category

Response

Preferences retrieved successfully

status
string
Example:

"success"

data
object[]