This application communicates with the BTC Map backend using JSON-RPC 2.0 protocol.
All RPC calls require authentication using a Bearer token:
Authorization: Bearer <password>
https://api.btcmap.org/rpc
Search for areas by query string.
Parameters:
{
"query": "string"
}Response:
{
"result": [
{
"id": "string",
"name": "string",
"type": "area"
}
]
}Retrieve detailed information about a specific area.
Parameters:
{
"id": "string"
}Response:
{
"result": {
"id": "string",
"created_at": "ISO8601",
"updated_at": "ISO8601",
"last_sync": "ISO8601",
"tags": {
"name": "string",
"type": "community|country",
"geo_json": "object",
"population": "number",
"area_km2": "number",
// ... other tags based on area type
}
}
}Create a new area with specified tags.
Parameters:
{
"tags": {
"name": "string",
"type": "community|country",
"geo_json": "object",
// ... other required/optional tags
}
}Response:
{
"result": {
"id": "string"
}
}Update or add a tag to an existing area.
Parameters:
{
"id": "string",
"name": "string",
"value": "any"
}Response:
{
"result": true
}Remove a tag from an existing area.
Parameters:
{
"id": "string",
"tag": "string"
}Response:
{
"result": true
}Delete an area completely.
Parameters:
{
"id": "string"
}Response:
{
"result": true
}All geographical boundaries must be valid GeoJSON Polygon or MultiPolygon:
{
"type": "Polygon",
"coordinates": [
[
[longitude, latitude],
[longitude, latitude],
// ... more coordinates
[longitude, latitude] // Close the polygon
]
]
}Required Tags:
name: Display nametype: "community"url_alias: URL-friendly identifiercontinent: One of: africa, asia, europe, north-america, oceania, south-americaicon:square: Icon identifierpopulation: Number of residentspopulation:date: Date in YYYY-MM-DD formatgeo_json: GeoJSON geometry
Optional Tags:
area_km2: Area in square kilometers (auto-calculated)organization: Managing organizationlanguage: Primary language- Contact information:
contact:twitter,contact:website, etc. tips:lightning_address: Lightning tips addressdescription: Area description
(Future implementation - requirements TBD)
All RPC calls may return errors in this format:
{
"error": {
"message": "Error description"
}
}Common error scenarios:
- Authentication failure (invalid token)
- Area not found (invalid ID)
- Validation errors (invalid data)
- Network timeouts
- Server errors
The application implements timeout handling:
- 20-second timeout for all RPC calls
- Automatic retry not implemented
- User feedback on timeout errors
- All numeric values should be sent as actual numbers, not strings
- GeoJSON should be sent as objects, not stringified JSON
- Dates should be in ISO8601 format
- URLs are validated for proper format
- Email addresses are validated with regex