POST
/
api
/
proxy
/
account
/
{accountId}
/
assign-auto
Assign Automatic Proxy
curl --request POST \
  --url https://onlyautomator.com/api/proxy/account/{accountId}/assign-auto \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "countryCode": "US",
  "forceReassign": true
}'
{
  "data": {
    "proxy_id": "ws_proxy_12345abcde",
    "proxy_address": "185.123.101.234",
    "proxy_port": 8080,
    "proxy_username": "username123",
    "proxy_password": "password123",
    "proxy_country_code": "US",
    "proxy_assigned_at": "2023-09-15T14:32:45Z",
    "proxy_mode": "auto",
    "message": "Proxy assigned successfully"
  }
}

Assign Automatic Proxy

This endpoint automatically assigns an available Webshare proxy to the specified OnlyFans account. It prioritizes proxies based on the user’s region preference, then country, and finally falls back to any available proxy. The system performs connectivity checks before assigning a proxy.
This process relies on the backend having a valid WEBSHARE_API_KEY configured in its environment variables to fetch available proxies from Webshare.io.

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:
  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.

Response Example

{
  "data": {
    "proxy_id": "ws_proxy_12345abcde",
    "proxy_address": "185.123.101.234",
    "proxy_port": 8080,
    "proxy_username": "username123",
    "proxy_password": "password123", // Included in this specific response
    "proxy_country_code": "US",
    "proxy_assigned_at": "2023-09-15T14:32:45Z",
    "proxy_mode": "auto",
    "message": "Proxy assigned successfully"
  }
}

Error Codes

This table provides context beyond the basic OpenAPI status codes.
Status CodeDescription
400Missing accountId or invalid format in request body.
401Authentication token is missing or invalid.
404The specified accountId does not exist.
409The account already has an active proxy and forceReassign was not set to true.
500An internal server error occurred during assignment (e.g., database error, Webshare API communication issue).
503No suitable, working proxies could be found in the Webshare pool after checking availability and connectivity, considering preferences.

Code Examples

// Using fetch
const assignAutoProxy = async (accountId, apiToken, countryCode = null, force = false) => {
  const body = {};
  if (countryCode) body.countryCode = countryCode;
  if (force) body.forceReassign = true;

  const response = await fetch(`https://onlyautomator.com/api/proxy/account/${accountId}/assign-auto`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${apiToken}`
    },
    body: JSON.stringify(body)
  });
  
  if (!response.ok) {
     const errorData = await response.json();
     throw new Error(`API Error (${response.status}): ${errorData.error}`);
  }
  return await response.json();
};

// Example usage (assign US proxy, force if needed)
assignAutoProxy('acc123', 'your_api_token', 'US', true)
  .then(data => console.log('Assignment result:', data))
  .catch(error => console.error('Error assigning proxy:', error));

Notes

  • The assignment logic prioritizes proxies based on: Preferred Country -> Preferred Region -> Any Country.
  • The system checks proxy connectivity before finalizing the assignment.
  • Assigned proxy credentials (including password) are returned in the success response but stored encrypted in the database.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Authorization
string
required

Bearer token for authentication (JWT)

Path Parameters

accountId
string<uuid>
required

The unique identifier of the OnlyFans account.

Body

application/json
countryCode
string | null

Optional ISO country code to prefer for assignment.

Example:

"US"

forceReassign
boolean | null
default:false

If true, overrides an existing proxy assignment.

Example:

true

Response

Proxy assigned successfully.

data
object