API Documentation

Access the Code to Adventure API to retrieve referral codes programmatically

📚
Overview

The Code to Adventure API provides programmatic access to Rivian referral codes. All requests must use HTTPS and responses are returned in JSON format.

https://codetoadventure.com/api.php

🔐
Authentication

The API currently uses IP-based rate limiting and does not require authentication tokens. This may change in future versions.

🚀
Endpoints

GET /api.php?path=random

Fetch Random Referral Code

Returns a single randomly selected referral code from the database.

Example Response
{
  "name": "John Doe",
  "username": "johndoe123",
  "referral_code": "ABC123",
  "link": "https://rivian.com/configurations/list?reprCode=ABC123"
}
GET /api.php?path=codes

Fetch All Referral Codes

Returns an array of all available referral codes in the database.

Example Response
[
  {
    "name": "John Doe",
    "username": "johndoe123",
    "referral_code": "ABC123",
    "link": "https://rivian.com/configurations/list?reprCode=ABC123"
  },
  {
    "name": "Jane Smith",
    "username": "janesmith456",
    "referral_code": "XYZ789",
    "link": "https://rivian.com/configurations/list?reprCode=XYZ789"
  }
]

⏱️
Rate Limiting

API requests are limited to 100 requests per minute per IP address to ensure fair usage.

Response Headers
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1635789600

⚠️
Error Responses

Errors are returned in a consistent JSON format with appropriate HTTP status codes.

Error Response Format
{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Too many requests. Please try again later."
  }
}

📊
HTTP Status Codes

Status Code Description
200 Success - Request completed successfully
404 Not Found - Endpoint does not exist
429 Rate Limit Exceeded - Too many requests
500 Server Error - Internal server error

💾
Caching

API responses are cached for 5 minutes to improve performance. Use the ETag header for conditional requests to check if data has changed.