API Documentation

Comprehensive guide to integrating with the SportFishTrader API. Select your account type below to view relevant documentation.

Individual Broker API

Welcome to the SportFishTrader API for individual brokers. This API allows you to programmatically create and manage your boat listings using a single API key tied to your broker account.

📌 Key Features:

  • Single API key authentication
  • Automatic broker attribution
  • Simple request/response pattern
  • Full CRUD operations on your listings

Authentication

All API requests require your broker API key in the x-api-key header. Your API key starts with sft_brkr_ and can be found in your account settings.

Example Authentication Header

Terminal
curl -X POST https://sportfishtrader.com/api/v1/listings \
  -H "x-api-key: sft_brkr_your_api_key_here" \
  -H "Content-Type: application/json"

⚠️ Security Warning: Never expose your API key in client-side code or public repositories. Always keep it secure on your server.

Create Listing

POST

Create a new boat listing

/api/v1/listings

Creates a new listing automatically attributed to your broker account.

Request Headers

HeaderValueRequired
x-api-keyYour broker API key (sft_brkr_...)Yes
Content-Typeapplication/jsonYes

Request Body

FieldTypeRequiredDescription
makestringYesBoat manufacturer
Example: Viking
modelstringYesBoat model
Example: 52 Sport Tower
yearnumberYesYear built
Example: 2018
pricenumberYesAsking price in USD
Example: 1250000
lengthnumberYesLength in feet
Example: 52
locationstringYesBoat location
Example: Fort Lauderdale, FL
descriptionstringOptionalDetailed description of the boat
photoURLsarrayOptionalArray of photo URLs

Response Example

{
  "success": true,
  "listingId": "lst_abc123def456",
  "message": "Listing created successfully"
}

Code Examples

JavaScript (Node.js)

JavaScript
const axios = require('axios');

const createListing = async () => {
  try {
    const response = await axios.post(
      'https://sportfishtrader.com/api/v1/listings',
      {
        make: 'Viking',
        model: '52 Sport Tower',
        year: 2018,
        price: 1250000,
        length: 52,
        location: 'Fort Lauderdale, FL',
        description: 'Pristine condition, low hours...',
        photoURLs: [
          'https://example.com/photo1.jpg',
          'https://example.com/photo2.jpg'
        ]
      },
      {
        headers: {
          'x-api-key': 'sft_brkr_your_api_key_here',
          'Content-Type': 'application/json'
        }
      }
    );
    
    console.log('Listing created:', response.data.listingId);
  } catch (error) {
    console.error('Error:', error.response.data);
  }
};

createListing();

Python

Python
import requests

def create_listing():
    url = 'https://sportfishtrader.com/api/v1/listings'
    headers = {
        'x-api-key': 'sft_brkr_your_api_key_here',
        'Content-Type': 'application/json'
    }
    data = {
        'make': 'Viking',
        'model': '52 Sport Tower',
        'year': 2018,
        'price': 1250000,
        'length': 52,
        'location': 'Fort Lauderdale, FL',
        'description': 'Pristine condition, low hours...',
        'photoURLs': [
            'https://example.com/photo1.jpg',
            'https://example.com/photo2.jpg'
        ]
    }
    
    try:
        response = requests.post(url, json=data, headers=headers)
        response.raise_for_status()
        result = response.json()
        print(f"Listing created: {result['listingId']}")
    except requests.exceptions.RequestException as e:
        print(f"Error: {e}")

create_listing()

cURL

Terminal
curl -X POST https://sportfishtrader.com/api/v1/listings \
  -H "x-api-key: sft_brkr_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "make": "Viking",
    "model": "52 Sport Tower",
    "year": 2018,
    "price": 1250000,
    "length": 52,
    "location": "Fort Lauderdale, FL",
    "description": "Pristine condition, low hours...",
    "photoURLs": [
      "https://example.com/photo1.jpg",
      "https://example.com/photo2.jpg"
    ]
  }'

Update Listing

PUT

Update an existing listing

/api/v1/listings/:listingId

Updates one or more fields of an existing listing you own.

Request Headers

HeaderValueRequired
x-api-keyYour broker API key (sft_brkr_...)Yes
Content-Typeapplication/jsonYes

URL Parameters

ParameterDescription
listingIdThe unique ID of the listing to update

Request Body

FieldTypeRequiredDescription
pricenumberOptionalUpdated price
Example: 1199000
descriptionstringOptionalUpdated description
locationstringOptionalUpdated location

Response Example

{
  "success": true,
  "message": "Listing updated successfully"
}

Code Example

JavaScript
const axios = require('axios');

const updateListing = async (listingId) => {
  try {
    const response = await axios.put(
      `https://sportfishtrader.com/api/v1/listings/${listingId}`,
      {
        price: 1199000,
        description: 'Updated description with price reduction...'
      },
      {
        headers: {
          'x-api-key': 'sft_brkr_your_api_key_here',
          'Content-Type': 'application/json'
        }
      }
    );
    
    console.log('Listing updated successfully');
  } catch (error) {
    console.error('Error:', error.response.data);
  }
};

updateListing('lst_abc123def456');

Get Listing

GET

Retrieve a specific listing

/api/v1/listings/:listingId

Fetches details of a single listing by ID.

Request Headers

HeaderValueRequired
x-api-keyYour broker API key (sft_brkr_...)Yes

URL Parameters

ParameterDescription
listingIdThe unique ID of the listing to retrieve

Response Example

{
  "success": true,
  "listing": {
    "id": "lst_abc123def456",
    "make": "Viking",
    "model": "52 Sport Tower",
    "year": 2018,
    "price": 1250000,
    "length": 52,
    "location": "Fort Lauderdale, FL",
    "createdAt": "2025-01-15T10:30:00Z",
    "status": "active"
  }
}

Error Reference

Common errors you may encounter when using the Broker API:

Missing API Key

Error Code: AUTH_001

Error Message: x-api-key header is required

Cause: Request was sent without the x-api-key header

Solution:

  • Include x-api-key header in all requests
  • Verify your API key is correctly configured
  • Check for typos in the header name

Invalid API Key Format

Error Code: AUTH_002

Error Message: API key must start with sft_brkr_, sft_brkrg_, or sft_org_

Cause: API key does not match the expected format

Solution:

  • Verify you copied the complete API key
  • Ensure no extra spaces or characters
  • Request a new API key if the format is incorrect

API Key Not Found

Error Code: AUTH_003

Error Message: API key does not exist in our system

Cause: The provided API key is not registered

Solution:

  • Generate a new API key from your account settings
  • Verify you are using the correct API key
  • Contact support if you believe this is an error

API Key Inactive

Error Code: AUTH_004

Error Message: This API key has been deactivated

Cause: The API key status is not active

Solution:

  • Reactivate the API key in your account settings
  • Generate a new API key
  • Contact support if you need assistance
Back to Home