Number Adder API

Home Dashboard

API Documentation

The Number Adder API lets you perform calculations, view history, and manage your account programmatically.

Base URL: https://number-adder.com

Contents

Getting Started

  1. Create an account on Number Adder
  2. Go to Settings
  3. Click Generate API Key
  4. Copy and save your key — it is only shown once

Your key will look like: na_a1b2c3d4e5f6...

Authentication

Include your API key in the X-API-Key header with every request:

curl https://number-adder.com/add \ -H "X-API-Key: na_your_key_here" \ -H "Content-Type: application/json" \ -d '{"a": 2, "b": 3}'

All endpoints require authentication. Requests without a valid key return 401 Unauthorized.

Endpoints

POST /add

Add two numbers together.

Request body

{ "a": 5, "b": 3 }

Response 200

{ "a": 5, "b": 3, "result": 8 }

Example

curl -X POST https://number-adder.com/add \ -H "X-API-Key: na_your_key_here" \ -H "Content-Type: application/json" \ -d '{"a": 5, "b": 3}'

POST /multiply PREMIUM

Multiply two numbers. Requires a premium subscription.

Request body

{ "a": 4, "b": 7 }

Response 200

{ "a": 4, "b": 7, "result": 28 }

Error 403 (not premium)

{ "detail": "Premium subscription required. Use /create-checkout-session to upgrade." }

Example

curl -X POST https://number-adder.com/multiply \ -H "X-API-Key: na_your_key_here" \ -H "Content-Type: application/json" \ -d '{"a": 4, "b": 7}'

GET /history

Get your calculation history, ordered by most recent first.

Response 200

{ "calculations": [ { "id": 42, "operation": "add", "num_a": 5, "num_b": 3, "result": 8, "created_at": "2025-01-15 10:30:00" } ] }

Example

curl https://number-adder.com/history \ -H "X-API-Key: na_your_key_here"

GET /me

Get your account information.

Response 200

{ "id": 1, "email": "user@example.com", "is_premium": 0, "stripe_customer_id": null, "created_at": "2025-01-01 00:00:00" }

Example

curl https://number-adder.com/me \ -H "X-API-Key: na_your_key_here"

GET /me/export

Export all your data as JSON (GDPR: Right to Portability).

Response 200

{ "user": { "id": 1, "email": "user@example.com", "is_premium": false, "created_at": "2025-01-01 00:00:00" }, "calculations": [ ... ], "export_timestamp": "2025-01-15T10:30:00" }

Example

curl https://number-adder.com/me/export \ -H "X-API-Key: na_your_key_here"

DELETE /me

Permanently delete your account and all associated data (GDPR: Right to Erasure). This action cannot be undone.

Response 200

{ "message": "Account and all associated data deleted successfully" }

Example

curl -X DELETE https://number-adder.com/me \ -H "X-API-Key: na_your_key_here"

Errors

The API returns standard HTTP status codes. Error responses include a detail field with a human-readable message.

Status Meaning
400 Bad request — invalid input or malformed JSON
401 Unauthorized — missing or invalid API key
403 Forbidden — premium subscription required (for /multiply)
404 Not found — resource does not exist
422 Validation error — request body failed validation

Error response format

{ "detail": "Premium subscription required. Use /create-checkout-session to upgrade." }