Docs/APIs/Fibonacci Generator

Fibonacci Generator

Generate Fibonacci sequence numbers

OperationalCredits 1 per callp50 326msMath/CalculationsStar

Overview

The Fibonacci Generator API computes Fibonacci sequence values along with derived statistics — a sum, the trailing 5 consecutive-value ratios, and the most recent ratio as an approximation of the golden ratio. It accepts two mutually-exclusive modes: `count` for a fixed-length response, or `maxvalue` for every Fibonacci number up to a numeric ceiling. An optional `startfrom` parameter advances the generator before emission begins. All arithmetic uses standard JavaScript Number type on the server, so values above Number.MAX_SAFE_INTEGER (around the 79th Fibonacci number) cannot be represented exactly — the precision ceiling is end-to-end. The ratios array is always truncated to the last 5 entries regardless of sequence length, and each ratio is rounded to 6 decimal places.

Endpoint

One host, one path per API. The block below shows this call in four languages; every one of them is the same HTTP request. Making requests covers the timeouts, retries and parameter rules that apply to all of them. The SDKs wrap the same call in a typed client.

GEThttps://api.apiverve.com/v1/fibonaccigenerator
curl "https://api.apiverve.com/v1/fibonaccigenerator?count=10&startfrom=0" \
  -H "x-api-key: your_api_key_here"
const res = await fetch('https://api.apiverve.com/v1/fibonaccigenerator?count=10&startfrom=0', {
  headers: { 'x-api-key': 'your_api_key_here' },
});

if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);

const { data } = await res.json();
console.log(data);
import requests

res = requests.get(
    "https://api.apiverve.com/v1/fibonaccigenerator?count=10&startfrom=0",
    headers={"x-api-key": "your_api_key_here"},
    timeout=15,
)
res.raise_for_status()

print(res.json()["data"])
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, _ := http.NewRequest("GET", "https://api.apiverve.com/v1/fibonaccigenerator?count=10&startfrom=0", nil)
	req.Header.Set("x-api-key", "your_api_key_here")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	out, _ := io.ReadAll(res.Body)
	fmt.Println(string(out))
}

Replace your_api_key_here with the key from your dashboard. When the inputs arrive as a list rather than one at a time, batch requests run up to 200 of them through this same API in a single call.

Authentication

Send your key in the x-api-key header. That is the only auth step — there is no token exchange and no per-endpoint scope to configure. Authentication covers creating, rotating and revoking keys.

401 is the only auth verdict

A 401 means the key is missing, invalid or expired. A 403 means the key is valid but not permitted here — blocked by a key restriction or an IP allow-list. Running out of credits is a 429.

Parameters

Sent in the query string. Premium parameters are accepted on every plan but only take effect on plans that include them.

ParameterTypeDescription
countRequiredintegerNumber of Fibonacci numbers to generate
range 1–1000
startfromOptionalintegerStart from this position in the sequence
range 0–∞

Response

Every API returns the same three top-level keys, so one response handler covers your whole integration: status, error and data. Only data changes shape. Response format covers the envelope, the other output formats and how premium fields are withheld.

Sample response
{
  "status": "ok",
  "error": null,
  "data": {
    "sequence": [
      0,
      1,
      1,
      2,
      3,
      5,
      8,
      13,
      21,
      34
    ],
    "count": 10,
    "start_from": 0,
    "first_value": 0,
    "last_value": 34,
    "sum": 88,
    "ratios": [
      1.666667,
      1.6,
      1.625,
      1.615385,
      1.619048
    ],
    "golden_ratio_approximation": 1.619048
  }
}

Response fields

Paths are relative to data. Premium fields are absent rather than zeroed on plans that do not include them, so check for presence instead of comparing to 0.

FieldTypeExampleDescription
sequencearray[0, ...]Array of generated Fibonacci numbers
Length is determined server-side based on maxvalue, not by the caller. May be empty when startfrom advances past maxvalue.
countnumber10Total count of Fibonacci numbers generated
start_fromnumber0Starting position in the Fibonacci sequence
first_valuenumber0First value in the generated sequence
last_valuenumber34Last value in the generated sequence
sumnumber88Sum of all numbers in the sequence
ratiosarray[1.666667, ...]Array of ratios between consecutive sequence values
Only the last 5 ratios are returned. Same skip rule for zero denominators. Each value rounded to 6 decimal places.
golden_ratio_approximationnumber1.619048Approximation of golden ratio from sequence ratios
Returns null when no ratios could be computed.

Errors

Read the HTTP status first, then error for the specific reason. The body names the parameter that has to change. Error handling covers the full status list and which of them are worth retrying.

StatusMeaningWhat to do
400Input was rejectedRead error; it names the parameter.
401Key missing or invalidCheck the header name and the key value.
403Key valid, but not permittedA key restriction or IP allow-list; see key scoping.
429Rate limited, or out of creditsRead error to tell them apart; see rate limits.

Use cases

Math Education
Teach Fibonacci sequences and golden ratio concepts in educational applications and tools
Algorithm Testing
Generate test data for algorithms and performance testing using Fibonacci sequences
Visual Design
Apply Fibonacci ratios and golden ratio proportions in design and layout calculations
Data Analysis
Use Fibonacci numbers in technical analysis, trading algorithms, and pattern recognition

Other ways to use Fibonacci Generator

Set up Fibonacci Generator on APIVerve, or reach the same source a different way. Your APIVerve account and credits work on all of them — one key, one balance.

Give it to an AI agentConnect over MCP and your agent calls it as a native tool — Claude, Cursor, ChatGPT.VerveKitReference →
Use it in Google Sheets or ExcelA =VERVE() formula fills a column — no script, no export, recalculates in place.VerveSheetsReference →
Ground an agent on itA cited, machine-checkable fact your model can't produce on its own.VerveContextReference →

More in Math/Calculations:

Was this page helpful?