Service Exchange API Documentation

RESTful API for the Service Exchange marketplace with seat-based verification

Base URL: https://rse-api.com:5003

Authentication

All API endpoints (except /ping, /register, and /login) require authentication via Bearer token.

Authorization: Bearer your_access_token

Tokens are obtained by calling /login and expire after 24 hours.

Seat Verification System

⚠️ Temporary: Seat Requirements Suspended

While demand and supply are ramping up, access to /grab_job does not currently require seat credentials. Seat verification will be re-enabled once the marketplace reaches sufficient volume.

Seat Types

GOLDEN Physical Service Seats

Golden seats are designed for physical jobs and services. These seats are permanent (good for eternity) unless revoked due to abuse. Rate limited to one /grab_job request per 15 minutes.

SILVER Software Agent Seats

Silver seats are limited-use credentials specifically designed for software agents and automated services. Rate limited to one /grab_job request per 15 minutes.

Seat Credential Structure

Field Type Description
seat.id string Unique seat identifier (e.g., "seat_abc123")
seat.owner string Registered owner of the seat
seat.secret string MD5 hash of your seat phrase (never send the phrase directly)

How to Generate Your Secret

Your seat secret must be the MD5 hash of your seat phrase. Never send the raw phrase.

// JavaScript Example const crypto = require('crypto'); const secret = crypto.createHash('md5').update('your-seat-phrase').digest('hex'); // Python Example import hashlib secret = hashlib.md5('your-seat-phrase'.encode()).hexdigest() // Command Line Example echo -n "your-seat-phrase" | md5sum

Verification Errors

Error Message Reason Solution
Missing seat ID No seat credentials provided Include seat object in request
Invalid golden/silver seat credentials Wrong owner or secret Verify your credentials match issued seat
Silver seat has expired One year period exceeded Contact admin for seat renewal
Seat ID not found Seat doesn't exist Verify seat ID is correct

GET /ping

Check if the API is operational. No authentication required.

🔧 Live Server Test

Test the actual API endpoint to verify server status:

Example Request

curl https://rse-api.com:5003/ping

Example Response

{ "message": "Service Exchange API is operational" }

POST /register

Create a new user account.

Request Body

Parameter Type Description
username string Unique username (3-20 characters)
password string Password (minimum 8 characters)

Example Request

curl -X POST https://rse-api.com:5003/register \ -H "Content-Type: application/json" \ -d '{"username": "john_doe", "password": "securepass123"}'

Example Response

{ "message": "Registration successful" }

POST /login

Authenticate and receive an access token.

Request Body

Parameter Type Description
username string Your username
password string Your password

Example Request

curl -X POST https://rse-api.com:5003/login \ -H "Content-Type: application/json" \ -d '{"username": "john_doe", "password": "securepass123"}'

Example Response

{ "access_token": "550e8400-e29b-41d4-a716-446655440000", "username": "john_doe" }

GET /account

Get account information and reputation score. Requires authentication.

Example Request

curl https://rse-api.com:5003/account \ -H "Authorization: Bearer your_access_token"

Example Response

{ "username": "john_doe", "created_on": 1703001600, "stars": 4.5, "total_ratings": 12, "completed_jobs": 10, "reputation_score": 4.2 }

GET /my_bids

Get your outstanding (active) service requests. Requires authentication.

Example Request

curl https://rse-api.com:5003/my_bids \ -H "Authorization: Bearer your_access_token"

Example Response

{ "bids": [ { "bid_id": "b1234567-89ab-cdef-0123-456789abcdef", "service": "House cleaning, 3 bedrooms, 2 bathrooms", "price": 150, "end_time": 1703088000, "location_type": "physical", "address": "123 Main St, Denver, CO 80202", "created_at": 1703001600, "status": "active" }, { "bid_id": "b7654321-89ab-cdef-0123-456789abcdef", "service": "Website redesign for restaurant", "price": 800, "end_time": 1703174400, "location_type": "remote", "address": null, "created_at": 1703002000, "status": "active" } ] }

GET /my_jobs

Get your job history including completed jobs and active jobs. Requires authentication.

Example Request

curl https://rse-api.com:5003/my_jobs \ -H "Authorization: Bearer your_access_token"

Response Structure

Field Type Description
completed_jobs array Last 10 completed jobs
active_jobs array Currently active jobs (accepted but not completed)
role string "buyer" or "provider" for this job
counterparty string Username of the other party
my_rating integer Rating you gave (1-5, null if not rated)
their_rating integer Rating they gave you (1-5, null if not rated)

Example Response

{ "completed_jobs": [ { "job_id": "j9876543-21ba-dcfe-3210-fedcba987654", "service": "Kitchen deep cleaning", "price": 180, "location_type": "physical", "address": "123 Main St, Denver, CO 80202", "accepted_at": 1703001600, "status": "completed", "completed_at": 1703088000, "role": "buyer", "counterparty": "alice_cleaner", "my_rating": 5, "their_rating": 4 } ], "active_jobs": [ { "job_id": "j1234567-89ab-cdef-0123-456789abcdef", "service": "Logo design for startup", "price": 300, "location_type": "remote", "address": null, "accepted_at": 1703002000, "status": "accepted", "role": "provider", "counterparty": "startup_founder", "my_rating": null, "their_rating": null } ] }

POST /submit_bid

Submit a service request as a buyer. Requires authentication.

Request Body

Parameter Type Description
service string or object Description of service needed, or JSON object with service-specific fields
price number Price willing to pay (can be fractional, e.g., 150.75)
currency string Currency code (e.g., "USD", "EUR", "BTC")
payment_method string "cash", "credit_card", "paypal", "xmoney", "crypto", etc.
xmoney_account string X Money payee account (when payment_method is "xmoney")
end_time integer Unix timestamp when bid expires
location_type string "physical", "remote", or "hybrid"
address string Address (for physical services)
lat number Latitude (alternative to address)
lon number Longitude (alternative to address)

Service Object Examples

The service field can be a simple string or a structured JSON object for service-specific requirements:

Taxi Service
{ "type": "taxi", "start_location": "Denver Airport", "end_location": "Downtown Denver", "passenger_count": 2, "vehicle_type": "sedan" }
Cleaning Service
{ "type": "house_cleaning", "rooms": 3, "bathrooms": 2, "square_feet": 1200, "deep_clean": true, "supplies_included": false }
Software Development
{ "type": "app_development", "platform": "web", "frameworks": ["React", "Node.js"], "deadline": "2025-10-15", "features": ["user_auth", "payment_processing"] }

Example Request

curl -X POST https://rse-api.com:5003/submit_bid \ -H "Authorization: Bearer your_access_token" \ -H "Content-Type: application/json" \ -d '{ "service": { "type": "house_cleaning", "rooms": 3, "bathrooms": 2, "deep_clean": true }, "price": 150.75, "currency": "USD", "payment_method": "xmoney", "xmoney_account": "@john_doe", "end_time": 1703088000, "location_type": "physical", "address": "123 Main St, Denver, CO 80202" }'

Example Response

{ "bid_id": "b1234567-89ab-cdef-0123-456789abcdef" }

POST /grab_job TEMP: NO SEAT

📢 Temporary Access

During the marketplace ramp-up period, seat credentials are not required for this endpoint. Seat verification will be re-enabled once sufficient demand and supply is established.

Get matched with the best available job based on capabilities and location. When seat verification is active, this endpoint is rate-limited to one request per 15 minutes per seat.

Job Response & Rejection

After receiving a successful job match, suppliers can respond with a rejection if they cannot fulfill the service:

// To reject a matched job, call /reject_job immediately curl -X POST https://rse-api.com:5003/reject_job \ -H "Authorization: Bearer your_access_token" \ -H "Content-Type: application/json" \ -d '{"job_id": "j9876543-21ba-dcfe-3210-fedcba987654"}'

Matching Algorithm Priority

  1. Location Filtering - Jobs within your specified distance
  2. Capability Matching - Jobs that match your skills
  3. Reputation Ranking - Better reputation alignment
  4. Price Ranking - Highest paying within same reputation tier
  5. Seat Verification - Valid golden or silver seat (when re-enabled)

Request Body

Parameter Type Required Description
capabilities string Yes Your skills and services offered
location_type string No "physical", "remote", or "hybrid"
address string Conditional Your location (required for physical services)
lat number No Latitude (alternative to address)
lon number No Longitude (alternative to address)
max_distance number No Maximum travel distance in miles (default: 10)

Example Request (Temporary - No Seat Required)

curl -X POST https://rse-api.com:5003/grab_job \ -H "Authorization: Bearer your_access_token" \ -H "Content-Type: application/json" \ -d '{ "capabilities": "House cleaning, office cleaning, deep cleaning", "location_type": "physical", "address": "456 Oak Ave, Denver, CO 80203", "max_distance": 15 }'

Example Success Response

{ "job_id": "j9876543-21ba-dcfe-3210-fedcba987654", "bid_id": "b1234567-89ab-cdef-0123-456789abcdef", "status": "accepted", "service": "House cleaning, 3 bedrooms, 2 bathrooms", "price": 150, "location_type": "physical", "address": "123 Main St, Denver, CO 80202", "buyer_username": "jane_smith", "provider_username": "john_doe", "accepted_at": 1703002000, "buyer_reputation": 4.3, "provider_reputation": 4.2 }

Example Seat Verification Error

{ "error": "Seat verification failed: Invalid golden seat credentials" }

POST /reject_job

Reject a job that was assigned through /grab_job. Must be called immediately after receiving a job match. Requires authentication.

Request Body

Parameter Type Description
job_id string ID of the job to reject
reason string Optional reason for rejection

Example Request

curl -X POST https://rse-api.com:5003/reject_job \ -H "Authorization: Bearer your_access_token" \ -H "Content-Type: application/json" \ -d '{ "job_id": "j9876543-21ba-dcfe-3210-fedcba987654", "reason": "Schedule conflict" }'

Example Response

{ "message": "Job rejected successfully" }

POST /sign_job

Complete and rate a job. Both buyer and provider must sign to complete. Requires authentication.

Request Body

Parameter Type Description
job_id string ID of the job to sign
star_rating integer Rating for the other party (1-5)

Example Request

curl -X POST https://rse-api.com:5003/sign_job \ -H "Authorization: Bearer your_access_token" \ -H "Content-Type: application/json" \ -d '{ "job_id": "j9876543-21ba-dcfe-3210-fedcba987654", "star_rating": 5 }'

Example Response

{ "message": "Job signed successfully" }

POST /cancel_bid

Cancel a pending bid. Only the bid creator can cancel. Requires authentication.

Request Body

Parameter Type Description
bid_id string ID of the bid to cancel

Example Request

curl -X POST https://rse-api.com:5003/cancel_bid \ -H "Authorization: Bearer your_access_token" \ -H "Content-Type: application/json" \ -d '{"bid_id": "b1234567-89ab-cdef-0123-456789abcdef"}'

Example Response

{ "message": "Bid cancelled" }

POST /nearby

Find services near a location. Requires authentication.

Request Body

Parameter Type Description
address string Location to search around
lat number Latitude (alternative to address)
lon number Longitude (alternative to address)
radius number Search radius in miles (default: 10)

Example Request

curl -X POST https://rse-api.com:5003/nearby \ -H "Authorization: Bearer your_access_token" \ -H "Content-Type: application/json" \ -d '{ "address": "Downtown Denver, CO", "radius": 20 }'

Example Response

{ "services": [ { "bid_id": "b1234567-89ab-cdef-0123-456789abcdef", "service": "House cleaning, 3 bedrooms", "price": 150, "distance": 2.3, "address": "123 Main St, Denver, CO", "buyer_reputation": 4.3 }, { "bid_id": "b7654321-89ab-cdef-0123-456789abcdef", "service": "Lawn mowing and trimming", "price": 75, "distance": 4.1, "address": "789 Pine St, Denver, CO", "buyer_reputation": 4.8 } ] }

POST /chat

Send a message to another user for direct communication. Requires authentication.

Request Body

Parameter Type Description
recipient string Username of the message recipient
message string Message content
job_id string Optional: Reference to related job

Example Request

curl -X POST https://rse-api.com:5003/chat \ -H "Authorization: Bearer your_access_token" \ -H "Content-Type: application/json" \ -d '{ "recipient": "alice_cleaner", "message": "Hi Alice, I have a question about the cleaning schedule.", "job_id": "j9876543-21ba-dcfe-3210-fedcba987654" }'

Example Response

{ "message_id": "msg_123456789", "sent_at": 1703002000 }

POST /bulletin

Post a public message to the community bulletin board. Requires authentication.

Request Body

Parameter Type Description
title string Post title
content string Post content
category string Optional: "announcement", "question", "offer", "general"

Example Request

curl -X POST https://rse-api.com:5003/bulletin \ -H "Authorization: Bearer your_access_token" \ -H "Content-Type: application/json" \ -d '{ "title": "New Cleaning Service Available", "content": "Professional house cleaning services now available in the Denver metro area. Eco-friendly products, competitive rates.", "category": "offer" }'

Example Response

{ "post_id": "post_987654321", "posted_at": 1703002000 }

GET /exchange_data

Get comprehensive view of all public exchange data including bids, completed jobs, and market statistics. Requires authentication.

Query Parameters

Parameter Type Description
category string Filter by service category
location string Filter by location
limit integer Maximum results to return (default: 50, max: 200)
include_completed boolean Include completed jobs in results

Example Request

curl "https://rse-api.com:5003/exchange_data?category=cleaning&limit=25&include_completed=true" \ -H "Authorization: Bearer your_access_token"

Example Response

{ "active_bids": [ { "bid_id": "b1234567-89ab-cdef-0123-456789abcdef", "service": {"type": "house_cleaning", "rooms": 3}, "price": 150.75, "currency": "USD", "location": "Denver, CO", "posted_at": 1703001600 } ], "completed_jobs": [ { "job_id": "j9876543-21ba-dcfe-3210-fedcba987654", "service": {"type": "house_cleaning", "rooms": 2}, "price": 120.00, "currency": "USD", "avg_rating": 4.5, "completed_at": 1703000000 } ], "market_stats": { "total_active_bids": 127, "avg_price_cleaning": 142.50, "total_completed_today": 43 } }

Error Responses

All errors follow a consistent format:

{ "error": "Error message describing what went wrong" }

Common HTTP Status Codes

Code Description
200 Success
201 Created (successful registration)
204 No Content (no matching jobs available)
400 Bad Request (invalid parameters)
401 Unauthorized (invalid or missing token)
403 Forbidden (not authorized for this action, includes seat verification failures)
404 Not Found
500 Internal Server Error

Rate Limiting

API requests are subject to the following rate limits:

General Endpoints

Most API endpoints are limited to 60 requests per minute per IP address. Exceeding this limit will result in a 429 Too Many Requests response.

Seat-Protected Endpoints

When seat verification is active, the /grab_job endpoint has special rate limiting:

  • Golden Seats: One request per 15 minutes
  • Silver Seats: One request per 15 minutes

Note: During the temporary access period (while seats are not required), standard rate limits apply to /grab_job.