Ir al contenido

Ficha de una gasolinera

GET
/v1/stations/{id}
curl --request GET \
--url https://api.preciosgasolina.es/v1/stations/example

Dirección, horario, coordenadas, precios de todos los carburantes y productos (AdBlue, HVO…) de una gasolinera. id = identificador del Ministerio o slug de su ficha.

Herramienta MCP equivalente: get_station.

Límite: 120 peticiones/min por IP. Caché: hasta la próxima actualización de los datos (≈ 8:00 y 20:00, hora peninsular).

id
obligatorio
string
>= 1 caracteres <= 120 caracteres /^[a-z0-9-]+$/

Correcto: sobre { data, meta }.

Tipo de contenidoapplication/json
object
data
obligatorio
object
key
propiedades adicionales
any
meta
obligatorio
object
api_version
obligatorio
string
request_id
obligatorio
string
last_updated
obligatorio

Fecha y hora de los datos (ISO 8601).

string | null
next_update
obligatorio

Próxima actualización prevista (≈ 8:00 y 20:00, hora peninsular).

string
data_age_seconds
obligatorio
Cualquiera de:
integer
>= -9007199254740991 <= 9007199254740991
stale
obligatorio

True si la fuente no respondió y se sirve la última copia buena.

boolean
source
obligatorio
string
attribution
obligatorio

Texto que debes mostrar junto a los datos (CC BY 4.0).

string
license
obligatorio
string formato: uri
web_url
obligatorio
Cualquiera de:
string formato: uri
Ejemplogenerated
{
"data": {},
"meta": {
"api_version": "example",
"request_id": "example",
"last_updated": "example",
"next_update": "example",
"data_age_seconds": 1,
"stale": true,
"source": "example",
"attribution": "example",
"license": "https://example.com",
"web_url": "https://example.com"
}
}
RateLimit-Policy
string

Política de límites aplicada (borrador IETF).

X-Request-Id
string

Identificador de la petición.

X-Cache
string

Hit, miss o stale.

Parámetros no válidos (INVALID_PARAMETER) o desconocidos.

Tipo de contenidoapplication/problem+json
object
type
obligatorio
string formato: uri
title
obligatorio
string
status
obligatorio
integer
>= -9007199254740991 <= 9007199254740991
detail
obligatorio
string
code
obligatorio

Código estable del error (p. ej. STATION_NOT_FOUND, RATE_LIMITED).

string
request_id
obligatorio
string
instance
string
Ejemplogenerated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"code": "example",
"request_id": "example",
"instance": "example"
}

No encontrado (STATION_NOT_FOUND, PROVINCE_NOT_FOUND…).

Tipo de contenidoapplication/problem+json
object
type
obligatorio
string formato: uri
title
obligatorio
string
status
obligatorio
integer
>= -9007199254740991 <= 9007199254740991
detail
obligatorio
string
code
obligatorio

Código estable del error (p. ej. STATION_NOT_FOUND, RATE_LIMITED).

string
request_id
obligatorio
string
instance
string
Ejemplogenerated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"code": "example",
"request_id": "example",
"instance": "example"
}

Demasiadas peticiones (RATE_LIMITED). Reintenta tras Retry-After.

Tipo de contenidoapplication/problem+json
object
type
obligatorio
string formato: uri
title
obligatorio
string
status
obligatorio
integer
>= -9007199254740991 <= 9007199254740991
detail
obligatorio
string
code
obligatorio

Código estable del error (p. ej. STATION_NOT_FOUND, RATE_LIMITED).

string
request_id
obligatorio
string
instance
string
Ejemplogenerated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"code": "example",
"request_id": "example",
"instance": "example"
}
Retry-After
integer

No disponible temporalmente (TEMPORARILY_UNAVAILABLE). Reintenta tras Retry-After.

Tipo de contenidoapplication/problem+json
object
type
obligatorio
string formato: uri
title
obligatorio
string
status
obligatorio
integer
>= -9007199254740991 <= 9007199254740991
detail
obligatorio
string
code
obligatorio

Código estable del error (p. ej. STATION_NOT_FOUND, RATE_LIMITED).

string
request_id
obligatorio
string
instance
string
Ejemplogenerated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"code": "example",
"request_id": "example",
"instance": "example"
}
Retry-After
integer

Fuente de los datos: Ministerio para la Transición Ecológica y el Reto Demográfico (Geoportal de Gasolineras). Datos de la API y del servidor MCP con licencia CC BY 4.0: cita Gasolina hoy y la fuente.