Spain Postal Code API

Look up codigo postals in Spain with PostalDataPI — sub-10ms responses, one API key for 70+ countries.

Country Code

ES

Format

NNNNN

Example

28001

About Spain codigo postals

Spain uses 5-digit postal codes. The first two digits indicate the province: 28 for Madrid, 08 for Barcelona, 41 for Seville.

Local term: codigo postal | Regex pattern: ^\d{5}$

API Usage Examples

cURL

curl -X POST https://postaldatapi.com/api/lookup \
  -H "Content-Type: application/json" \
  -d '{"zipcode": "28001", "country": "ES", "apiKey": "YOUR_API_KEY"}'

Python

from postaldatapi import PostalDataPI

client = PostalDataPI(api_key="YOUR_API_KEY")
result = client.lookup("28001", country="ES")
print(result.place_name, result.latitude, result.longitude)

Node.js

import { PostalDataPI } from 'postaldatapi';

const client = new PostalDataPI({ apiKey: 'YOUR_API_KEY' });
const result = await client.lookup('28001', { country: 'ES' });
console.log(result.placeName, result.latitude, result.longitude);

$0.000028 per query

Same price for Spain and all 70+ countries. No tiers, no per-country pricing.

Spain Postal Code API | PostalDataPI