Skip to main content

Quickstart Guide

Get started with the Rivegen API in 5 minutes.

Prerequisites

  • A Rivegen account (authenticated access)
  • cURL, JavaScript (fetch), or Python (requests)

Step 1: Authenticate

Get your access token:

curl -X POST "https://api.rivegen.com/api/auth/login" \
-H "Content-Type: application/json" \
-d '{
"username": "your_username",
"password": "your_password"
}'

Response:

{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "bearer",
"expires_in": 3600
}

Store the access_token for use in subsequent requests.

Step 2: Create a Project

Organize your rivers in projects:

curl -X POST "https://api.rivegen.com/api/projects" \
-H "Authorization: Bearer <your_access_token>" \
-H "Content-Type: application/json" \
-d '{
"name": "My First Project",
"description": "Exploring river generation"
}'

Response:

{
"project_id": "project_123",
"name": "My First Project",
"created_at": "2024-01-15T10:30:00Z"
}

Step 3: Generate a River

Start your first river generation:

curl -X POST "https://api.rivegen.com/api/rivers/generate" \
-H "Authorization: Bearer <your_access_token>" \
-H "Content-Type: application/json" \
-d '{
"project_id": "project_123",
"parameters": {
"length": 1000,
"width": 50,
"depth": 10,
"flow_rate": 100,
"terrain_type": "mountain"
}
}'

Response:

{
"river_id": "river_456",
"status": "generating",
"estimated_completion": "2024-01-15T11:00:00Z"
}

Step 4: Check Status

Poll for generation status:

curl -X GET "https://api.rivegen.com/api/rivers/river_456/status" \
-H "Authorization: Bearer <your_access_token>"

Step 5: Get Results

Once status is "completed", retrieve the river:

curl -X GET "https://api.rivegen.com/api/rivers/river_456" \
-H "Authorization: Bearer <your_access_token>"

Next Steps