For developers

Documentation

Connect your system to Ciudad Viva to publish your events automatically. Your infrastructure doesn't change — we are the ones who query your API.

Overview

Ciudad Viva's API integration is an automatic extraction(pull) system: Ciudad Viva periodically queries your API, gets the events and publishes them on the platform. Your system doesn't need to know that Ciudad Viva exists or send anything on its own.

🔗

No changes to your system

All you need is an API URL that returns your events as JSON.

🔄

Automatic sync

We sync daily at 1 AM (Chile time). You can also trigger manual syncs.

🔒

Secure credentials

Your API credentials are stored encrypted and are never exposed on the platform.

How it works

The process has two actors: your system (which already exists and doesn't change) and Ciudad Viva (which queries it).

  1. 1

    You set up the integration

    From your organization's dashboard on Ciudad Viva, you enter your API URL, the HTTP method, the authentication credentials (if any) and the field mapping.

  2. 2

    You test the connection

    You click "Test connection". Ciudad Viva queries your API right then and shows how many events it found and a preview of the first results.

  3. 3

    You activate the integration

    Once the test succeeds, you activate the integration. From then on, Ciudad Viva syncs your events automatically.

  4. 4

    Daily sync

    Every day at 1 AM (Chile time), Ciudad Viva queries your API, creates new events, updates the ones that changed and deactivates the ones that are no longer there.

Your API requirements

Your API can have any structure, as long as it meets these basic requirements:

  • ✓It responds with JSON (Content-Type: application/json).
  • ✓It returns an array of events, either at the root of the response or inside some field.
  • ✓Each event has at least a title and a start date.
  • ✓The URL is reachable from the internet (it can't be localhost or a private internal network).
  • ✓It accepts GET or POST as the HTTP method.
Does your API require pagination? For now the integration queries the URL once per sync. If your API paginates results, set up a URL that returns all the events at once (for example, with a high limit or an export endpoint).

Step-by-step setup

Go to your organization's dashboard on Ciudad Viva and follow these steps:

  1. 1

    Go to My organization → Integrations → New integration.

  2. 2

    Enter a descriptive name (e.g. "Municipal events API").

  3. 3

    Enter your API's URL.

  4. 4

    Select the HTTP method (GET or POST).

  5. 5

    If your API returns the events inside a field (e.g. data.results), enter that path in Path to the events array. If the array is at the root, leave this field empty.

  6. 6

    Set up authentication if your API requires it (see the Authentication section).

  7. 7

    Set up the field mapping, indicating which field of your API corresponds to each Ciudad Viva field (see the Field mapping section).

  8. 8

    Click Test connection to check that everything works.

  9. 9

    If the test succeeds, click Activate.

Authentication

Ciudad Viva supports four authentication methods. Choose the one your API uses. Credentials are stored encrypted with AES-256-GCM and are never exposed in logs or responses.

No authentication

For public APIs that don't require credentials.

{
  "auth": {
    "type": "none"
  }
}

API Key

Ciudad Viva will send your key in the header you define. You choose the header name (e.g. X-API-Key, Authorization).

{
  "auth": {
    "type": "api_key",
    "apiKeyHeader": "X-API-Key",
    "apiKey": "your-secret-key"
  }
}

Bearer Token

Ciudad Viva will send the header Authorization: Bearer <token>.

{
  "auth": {
    "type": "bearer",
    "bearerToken": "eyJhbGciOiJIUzI1NiJ9..."
  }
}

Basic Auth

Ciudad Viva will Base64-encode the username:password pair and send it in the header Authorization: Basic <encoded>.

{
  "auth": {
    "type": "basic",
    "basicUsername": "my-username",
    "basicPassword": "my-password"
  }
}

Response format

Your API can return the events in any of these structures. The Path to the array field tells Ciudad Viva where to find the events array.

Array at the root (Path to the array: empty)

[
  {
    "title": "Summer Festival",
    "date": "2026-02-15",
    "location": "Parque O'Higgins"
  },
  {
    "title": "Theater Play",
    "date": "2026-02-20",
    "location": "Teatro Municipal"
  }
]

Array inside a field (Path to the array: events)

{
  "status": "ok",
  "total": 2,
  "events": [
    {
      "title": "Summer Festival",
      "date": "2026-02-15"
    }
  ]
}

Array nested several levels deep (Path to the array: data.results)

{
  "meta": { "page": 1 },
  "data": {
    "results": [
      {
        "content": {
          "title": "Summer Festival",
          "start": "2026-02-15T20:00:00"
        }
      }
    ]
  }
}

Field mapping

The mapping tells Ciudad Viva which field of your API corresponds to each platform field. You can use dot notation to access nested fields (e.g. content.title, meta.date.start).

Ciudad Viva fieldStatusDescriptionExample value
titlerequiredEvent nameSummer Festival
startDaterequiredStart date and time (ISO 8601 or plain date)2026-02-15T20:00:00
endDateoptionalEnd date and time2026-02-15T23:00:00
descriptionoptionalEvent descriptionA big music festival...
imageUrloptionalMain image URLhttps://example.com/image.jpg
venueoptionalVenue or place nameParque O'Higgins
addressoptionalEvent addressAv. Tupper 1955, Santiago
districtoptionalEvent district (comuna)Santiago
priceoptionalPrice or admission descriptionFree admission
eventUrloptionalEvent URL on your sitehttps://example.com/events/festival
externalIdoptionalUnique ID in your system. Recommended for accurate deduplication.EVT-2026-001
categoryoptionalEvent category. If it doesn't match, the default category is used.Música

Mapping configuration example

If your API returns content.name as the title and meta.startAt as the start date, the mapping would be:

{
  "fieldMap": {
    "title": "content.name",
    "startDate": "meta.startAt",
    "endDate": "meta.endAt",
    "description": "content.body",
    "imageUrl": "content.coverImage",
    "venue": "location.name",
    "address": "location.address",
    "district": "location.commune",
    "price": "ticket.description",
    "eventUrl": "permalink",
    "externalId": "id"
  }
}

Deduplication

If you map the externalId field, Ciudad Viva will use it to uniquely identify events and avoid duplicates. If you don't map it, it will use a hash of the title and start date instead. We recommend always mapping an external ID for greater accuracy.

Connection test

Before activating the integration, you can test the connection from the setup form. Ciudad Viva will query your API right then and show:

  • →Your API's HTTP response code.
  • →How many events it found in the response.
  • →A preview of the first 3 events with the mapping applied.
  • →The error message if something fails (wrong URL, rejected authentication, field not found, etc.).

You can only activate the integration if the connection test succeeded. If you change the setup after activating it, the integration goes back to draft status and you'll need to test it again.

Webhook (optional)

In addition to the automatic daily sync, you can set up a webhook so Ciudad Viva syncs your events at the moment you need it. When you create a new event in your system, your system can notify Ciudad Viva immediately and the event will appear on the platform without waiting until the next day.

Turn on the webhook

In your integration's dashboard, turn on the Webhook option. Ciudad Viva will generate a unique URL and an API Key for your integration. The URL has this format:

https://server.ciudad-viva.cl/api/webhooks/{your-webhook-key}

Call the webhook from your system

Send a POST to the webhook URL when you want to sync. The request body can be empty — you don't need to send data, as Ciudad Viva will query your API anyway.

curl -X POST \
  "https://server.ciudad-viva.cl/api/webhooks/{your-webhook-key}"

# Successful response (HTTP 202):
{ "queued": true }

Rate limit

To protect your system and ours, the webhook has a limit of 1 call every 10 seconds(at most 6 per minute). Calls over this limit will receive an HTTP 429 response. If you publish many events in short bursts, don't worry: the daily sync will pick them up anyway.

# If you exceed the limit:
HTTP 429 Too Many Requests
{ "error": "rate_limit_exceeded", "retryAfterMs": 8500 }

Webhook security

The webhook URL contains a unique security token. Treat it like a password: don't share it publicly or include it in code repositories. You can regenerate the key at any time from the dashboard; the previous key becomes invalid immediately.

Sync

Every sync follows this process:

•

Queries your API

Ciudad Viva makes the HTTP request with the setup you defined (URL, method, authentication, headers).

•

Extracts the events

It navigates to the configured path inside the response and applies the field mapping to each event.

•

New events

Those that didn't exist on Ciudad Viva are created. If your organization is verified, they're approved immediately; otherwise, they stay under review.

•

Existing events

Those that already exist (identified by externalId or hash) are updated if they changed.

•

Missing events

Those that were on Ciudad Viva but are no longer in your API are deactivated automatically.

•

Run log

Ciudad Viva keeps a log with the results: how many events it found, created, updated, left unchanged, deactivated and how many failed.

Error notifications

If your API fails 3 syncs in a row, Ciudad Viva will send you an alert email so you can look into it. The integration will keep trying in the following cycles.

Coming soon

Direct event publishing

We're building an endpoint that will let you create events on Ciudad Viva directly from your system, without needing your own API. You just send a POST with the event data and it appears on the platform. It's ideal for internal systems like municipal ERPs, ticketing systems or cultural calendars that want to publish on Ciudad Viva without publicly exposing their API.

The documentation for this endpoint will be published here when it's available.

Need help?

If you have questions about the integration or need support, contact us.

Contact the team