Generales29N.com, a project by Color Vivo (the company that publishes this site), has released documentation for a JSON API that lets media outlets and apps integrate the provisional results of Spain’s general election on 29 November 2026, built on the data released by the Spanish Ministry of the Interior. It is a free beta, requires a personal key and is designed to be called from a server, not a browser. This guide covers its endpoints, fields, data sources and how to build an integration that holds up on election night.

Key takeaways on the Generales29N API in 30 seconds

  • What: a read-only JSON API with results for Spain as a whole, regions, provinces, municipalities and overseas votes, plus historical elections.
  • Source: the Ministry of the Interior’s provisional results, normalized; seat counts are the project’s own calculation until official figures exist.
  • Usage: an API key header, polling the manifest every 10 to 15 seconds and a cap of 300 requests per minute.
  • Testing: simulation datasets let teams test the full flow before Sunday.

The documentation states that Generales29N.com is an independent information site, not an official site of the Ministry of the Interior or the Electoral Board, and that the official Interior figure always prevails if there is any discrepancy.

Where the data comes from

Everything starts with the Ministry of the Interior’s provisional count, which begins after polling stations close at 20:00 on Sunday 29 November. For this election, the ministry has set up an access route for media with files that are updated as provisional results come in, plus auxiliary files with candidate lists and the July 2023 general election count. According to the Generales29N documentation, Interior sends data several times an hour early in the evening and every few minutes during the count, and the API publishes each update within seconds.

The API adds the intermediate layer: it normalizes the data, aggregates it by scope and calculates seats and turnout from the provisional results. Historical datasets, such as July 2023, cite Infoelectoral, the ministry’s results archive, as their source. Province and municipality codes follow the INE (Spain’s National Statistics Institute) coding scheme. INE puts the electorate at 38,728,356 voters, 2,769,645 of them living abroad.

One rule matters for any newsroom: a file without a source is never published, and when the seats_label field is not null, seats are the project’s own calculation and that label must be shown with the figures. If the calculation differs from the official allocation, the API publishes the official one, flagged with seats_source: "official".

Endpoints, authentication and fields

The base URL is https://api.generales29n.com/v1/. Every request needs an X-Api-Key header; without it the API returns 401, and with an invalid or revoked key, 403. Only GET and HEAD are allowed, and there are no CORS headers, so the API cannot be called from browser JavaScript. The key must never ship in client code.

  • {election}/manifest.json: the entry point, with seq, phase, counted_pct, stale, embargo, base and the indexes.
  • {base}es.json, {base}ccaa/{code}.json and {base}prov/{2-digit INE code}.json: results by scope.
  • {base}cera/{code}.json: overseas votes by province.
  • {base}_idx/mun/{prov}.json: the municipality index. Municipality paths must not be built by hand, because they do not exist in releases where that municipality did not change.
  • {base}_idx/winners.json and {base}_idx/winners/scopes.json: winners by municipality, province and region.
  • v1/hist/{election}/{scope}.json: historical data, for example congreso-2023-07.

The election slugs are congreso-2026-11 (Congress) and senado-2026-11 (Senate), and there are simulations (congreso-simulacro, senado-simulacro) for testing before Sunday. Simulations are test data, not results. Each scope includes turnout, counted (polling stations counted), totals (valid, blank and null votes) and a results list with party, acronym, color, votes, percentage and seats.

A first call to check your key:

curl -s -H "X-Api-Key: YOUR_KEY" https://api.generales29n.com/v1/congreso-simulacro/manifest.json | jq '{seq, phase, counted_pct, embargo, stale}'Code language: JavaScript (javascript)

An integration that survives election night

The recommended pattern is simple: poll only the manifest every 10 to 15 seconds, compare its seq with the last one processed and download scopes only when it changes. Compare seq for inequality, not for greater than, because it can go down if an erroneous release is withdrawn. Files for each seq are immutable and cached for a year; the manifest is cached for 5 seconds. Above 300 requests per minute the API returns 429 with a Retry-After header.

For a media site, the sensible setup is a server-side process that writes the JSON to disk while the website serves readers from there, never from the API. A minimal Python example with no external dependencies:

import json, os, time, urllib.request, urllib.error

API = "https://api.generales29n.com/v1/"
ELECTION = "congreso-simulacro"   # switch to congreso-2026-11 on Sunday
KEY = os.environ["G29N_API_KEY"]
OUT = "/var/www/elections/data"
SCOPES = ["es.json", "prov/28.json", "prov/08.json"]

def url(path):
    return path if path.startswith("http") else API + path

def fetch(path):
    req = urllib.request.Request(url(path), headers={"X-Api-Key": KEY})
    with urllib.request.urlopen(req, timeout=10) as r:
        return json.load(r)

def save(name, data):
    target = os.path.join(OUT, name.replace("/", "_"))
    tmp = target + ".tmp"
    with open(tmp, "w") as f:
        json.dump(data, f)
    os.replace(tmp, target)   # atomic write

last = None
while True:
    wait = 12
    try:
        m = fetch(ELECTION + "/manifest.json")
        save("manifest.json", m)
        if m["seq"] != last and not m.get("embargo"):
            for scope in SCOPES:
                save(scope, fetch(m["base"] + scope))
            last = m["seq"]
    except urllib.error.HTTPError as e:
        if e.code == 429:
            wait = int(e.headers.get("Retry-After", 30))
        # on any error, keep serving the last valid data
    except Exception:
        pass
    time.sleep(wait)Code language: PHP (php)

With embargo: true there are no results and only turnout is published, so the script skips scopes until it lifts. Front ends should always show the data timestamp (updated_at), warn when stale is true, label seats as provisional while seats_provisional says so and note that overseas votes can move a province’s last seat. The phase field moves through pre, turnout, results, provisional_final and final, which is handy for switching page layouts during the night.

The beta terms require visible attribution next to the data («Fuente: Ministerio del Interior · Datos: Generales29N.com (Color Vivo)»), a note that seats are the project’s own calculation where applicable, a mention of Color Vivo with a link or promotional space for noticias.madrid, and they forbid reselling or redistributing the data as an API. There is no SLA and access can be revoked. Keys are requested by email or through Color Vivo’s contact form, stating the outlet, intended use, server or native app access, expected users on election night and a technical contact.

Frequently asked questions

Is this an official Ministry of the Interior API?

No. It is an independent Color Vivo project that normalizes the provisional results released by the ministry. The official figure always prevails.

Can I call the API from the browser?

No. It sends no CORS headers and the key must not be exposed client-side. Call it from a server or native app and serve readers from your own cache.

How often should I poll?

The manifest every 10 to 15 seconds, other files only when seq changes. The limit is 300 requests per minute per key.

How can I test before 29 November?

Use the congreso-simulacro and senado-simulacro slugs, which return test data with the same structure.

Sources:

Scroll to Top