• Search API v1
  • Authentication
  • Using OAuth2 authorization
  • Query Language and Geo Filtering
  • Using facets
  • Dataset Catalog APIs
  • Dataset Records APIs
  • Search API v1

    OpenDataSoft datasets are accessible by developers through an HTTP REST API.

    The domain https://examples.opendatasoft.com will be used to illustrate examples given in the following documentation.

    API Console

    Available APIs

    The available APIs are listed below.

    API Name Description
    Dataset search API Search datasets in a catalog
    Dataset lookup API Find a dataset based on its identifier
    Records search API Search records within a given dataset
    Records lookup API Find a record based on its identifier
    Analysis API Build advanced aggregations of records from a given dataset
    Download API Efficiently download a large number of records from a given dataset
    Geo clustering API Build geo clusters of records from a given dataset
    Real time push API Push new records to a given dataset in real time
    Multimedia download API Download multimedia content attached to a dataset or a record

    These APIs return JSON by default, except:

    The real time push API is very specific and will not be detailed in the following documentation. Please refer to the platform documentation for more information about this API.

    These APIs support cross-domain access from a browser using CORS. For older browsers or other specific purposes, JSONP is supported when returning JSON content by adding a callback parameter.

    Finding a dataset identifier

    To access a dataset directly via the dataset lookup API or record related APIs, its identifier must be provided. This identifier is found in the information tab of each dataset.

    HTTP Methods

    All API endpoints support both GET and POST requests. GET methods are preferred, but POST methods can be used to work around browser, library or proxy limitations regarding the size of HTTP URLs.

    Security

    All API endpoints are protected by the same authentication and authorization model.

    Anonymous access and authenticated users can be restricted to:

    All API endpoints are available in HTTPS, which use is highly recommended wherever possible.

    The following authentication modes are available:

    Quotas

    All API endpoints are subject to quota-based limitations. According to the domain configuration, authenticated users may have extended quotas compared to anonymous access. Please contact the domain administrator for more information about a user's quotas.

    The API response contains three headers to indicate the current state of a user's quota:

    Errors handling

    Example of an error occurring when you reach the domain requests limit

    > GET https://examples.opendatasoft.com/api/datasets/1.0/search/ HTTP/1.1
    
    < HTTP/1.0 429 TOO MANY REQUESTS
    
    {
      "errorcode": 10002,
      "reset_time": "2017-10-17T00:00:00Z",
      "limit_time_unit": "day",
      "call_limit": 10000,
      "error": "Too many requests on the domain. Please contact the domain administrator."
    }
    

    Example of an error occurring when you reach the requests limit for anonymous users

    > GET https://examples.opendatasoft.com/api/datasets/1.0/search/ HTTP/1.1
    
    < HTTP/1.0 429 TOO MANY REQUESTS
    
    {
      "errorcode": 10005,
      "reset_time": "2017-10-17T00:00:00Z",
      "limit_time_unit": "day",
      "call_limit": 1000,
      "error": "You have exceeded the requests limit for anonymous users."
    }
    

    When an error occurs, a JSON object describing the error is returned by the API.

    Authentication

    An authenticated user can be granted access to restricted datasets and benefit from extended quotas for API calls. The API features an authentication mechanism for users to be granted their specific authorizations.

    For the platform to authenticate a user, you need to either:

    Finding and generating API keys

    API keys are managed via your user profile page at https://<youropendatasoftportal>.com/account/ or by clicking on your name in the header.

    Link to account settings

    Go to the tab named My API keys to see your existing API keys, revoke them and create new ones.

    Account's API keys page

    Providing API keys within requests

    Unauthenticated request on private portal

    > GET https://private-portal.opendatasoft.com/api/v2/catalog/datasets/ HTTP/1.1
    
    < HTTP/1.0 401 Unauthorized
    

    Request authenticated with an API key

    > GET https://private-portal.opendatasoft.com/api/v2/catalog/datasets/?apikey=7511e8cc6d6dbe65f9bc8dae19e08c08a2cab96ef45a86112d303eee HTTP/1.1
    
    < HTTP/1.0 200 OK
    
    {
        "total_count": 4,
        "links": [{
            "href": "https://private-portal.opendatasoft.com/api/v2/catalog/datasets?start=0&include_app_metas=False&rows=10",
            "rel": "self"
        }, {
            "href": "https://private-portal.opendatasoft.com/api/v2/catalog/datasets?start=0&include_app_metas=False&rows=10",
            "rel": "first"
        }, {
            "href": "https://private-portal.opendatasoft.com/api/v2/catalog/datasets?start=0&include_app_metas=False&rows=10",
            "rel": "last"
        }],
        "datasets": [...]
    }
    

    API keys are passed along requests through the query parameter apikey.

    For example, accessing a private portal's catalog unauthenticated will return a 401 Unauthorized error.

    But passing the API key of an authorized user will return the JSON response with the list of accessible datasets for this user on the portal.

    Using OAuth2 authorization

    Overview

    OpenDataSoft implements the OAuth2 authorization flow, allowing third party application makers to access the data hosted on an OpenDataSoft platform on behalf of a user while never having to deal with a password, thus avoiding any user credential to be compromised.

    The OpenDataSoft OAuth2 authorization flow is compliant with RFC 6749 and makes use of Bearer Tokens in compliance with RFC 6750.

    Application developers who want to use the OpenDataSoft APIs with OAuth2 must go through the following steps, which will be explained in this section.

    1. Register their application with the OpenDataSoft platform.
    2. Request approval from users via an OAuth2 authorization grant.
    3. Request a bearer token that will allows them to query the OpenDataSoft platform APIs for a limited amount of time.
    4. Refresh the Bearer Token when it expires.

    Currently, applications are registered on a specific domain and can only access data on this domain.

    Register an application for OAuth2 authentication

    OAuth2 applications management interface

    1. Go to the My applications tab of your account page on the domain you want to register the application on.
    2. Fill the registration form with the following information:
      • Application name: the name of the application
      • Type:
        • confidential: client password is kept secret from the user and only used from a trusted environment (e.g: a web service, where the client password is stored server-side and never sent to the user)
        • public: client password is embedded in a client-side application, making it potentially available to the world (e.g: a mobile or desktop application)
      • Redirection URL: the URL users will be redirected to after they have granted you permission to access their data
    3. Store the resulting client ID and client secret that will be needed to perform the next steps.

    Getting an authorization grant

    Example call to /oauth2/authorize/

    GET /oauth2/authorize/?
        client_id=123456789&
        redirect_uri=https://example.com&
        response_type=code&
        state=ilovedata&
        scope=all HTTP/1.1
    

    To get an authorization grant from a user:

    1. Redirect them to /oauth2/authorize/ with the appropriate query parameters.
    2. The user will then be authenticated in the platform and redirected to a page identifying your application.
    3. From there, the user will review the information you filled in the form described above and the scope of the requested access, and grant your application the right to access their data.
    4. Once the user has accepted those terms, they will be redirected to your application's redirection URL with query parameters describing your authorization grant.

    The query parameters you need to supply when redirecting the user are the following:

    Redirection following a successful authorization

    HTTP/1.0 302 FOUND
    Location: https://example.com?state=ilovedata&code=gKnAQc2yIfdz2mY25xxgpTY2uyG5Sv
    

    The authorization grant redirect will have these values:

    The 30-character authorization code must now be converted into a bearer token within 1 hour before expiring.

    Converting an authorization grant to a bearer token

    Example call to /oauth2/token/

    POST /oauth2/token/ HTTP/1.1
    
    client_id=cid&
        client_secret=csc&
        grant_type=authorization_code&
        code=GokshWxRFXmW0MaLHkDv5HrG6wieGs&
        scopes=all&
        redirect_uri=https://example.com&
        state=ilovedata
    

    To receive a bearer token, convert the previously obtained authorization grant via a POST request to /oauth2/token/ with the following parameters:

    Alternative call with an Authorization header

    POST /oauth2/token/ HTTP/1.1
    Authorization: Basic Y2lkOmNzYw==
    
    grant_type=authorization_code&
        code=GokshWxRFXmW0MaLHkDv5HrG6wieGs&
        scopes=all&
        redirect_uri=https://example.com&state=ilovedata
    

    Alternatively, you can pass your client ID and client secret through the Authorization header

    Example response for a bearer token request

    HTTP/1.0 200 OK
    Content-Type: application/json
    
    {
        "access_token": "9kxoTUYvSxnAiMpv008NBqRiqk5xWt",
        "expires_in": 3600,
        "token_type": "Bearer",
        "state": "ilovedata",
        "scope": "all",
        "refresh_token": "jFfDUcsK9zzNMs1zwczzJxGrimPtmf"
    }
    

    The response to this request is a JSON representation of a bearer token, which contains the following values:

    Using the bearer token

    Using the token as a query parameter

    GET /api/end/point?access_token=9kxoTUYvSxnAiMpv008NBqRiqk5xWt HTTP/1.1
    

    Using the token in an Authorization header

    GET /api/end/point HTTP/1.1
    Authorization: Bearer 9kxoTUYvSxnAiMpv008NBqRiqk5xWt
    

    Using the token in the request body

    GET /api/end/point HTTP/1.1
    
    access_token=9kxoTUYvSxnAiMpv008NBqRiqk5xWt
    

    The bearer token can be passed along requests for authentication in three different ways:

    Refreshing a bearer token

    Example token refresh call

    POST /oauth2/token/ HTTP/1.1
    
    client_id=cid&
        client_secret=csc&
        grant_type=refresh_token&
        refresh_token=jFfDUcsK9zzNMs1zwczzJxGrimPtmf&
        scopes=all&
        redirect_uri=https://example.com&
        state=ilovedata
    

    To refresh an expired bearer token, send a request to the /oauth2/token/ endpoint, with the following query parameters:

    The response to this request is identical to the bearer token response.

    Query Language and Geo Filtering

    Filtering features are built in the core of OpenDataSoft API engine. Many of the previously listed APIs can take as a parameter filters for constraining the list of returned datasets or records.

    Note that a given filtering context can simply be copied from one API to another. For example, you can easily build a user interface which first allows the user to visually select the records their are interested in, using full text search, facets and geo filtering, and then allowing them to download these records with the same filtering context.

    Query language

    The OpenDataSoft query language makes it possible to express complex boolean conditions as a filtering context.

    The user query can most of the time be expressed through the q HTTP parameter.

    q=film -> results that contain film, films, filmography, etc.
    q="film" -> results containing exactly film.
    

    The query language accepts full text queries.

    If a given word or compounds is surrounded with double quotes, only exact matches are returned (modulo an accent and case insensitive match).

    Boolean expressions

    film OR trees
    (film OR trees) AND paris
    

    The query language supports the following boolean operators AND, OR and NOT.

    Parenthesis can be used to group together expressions and alter the default priority model:

    Field queries

    Search on https://public.opendatasoft.com for datasets having "Paris" in their title or description and containing at least 50 000 records

    GET https://public.opendatasoft.com/api/datasets/1.0/search?q=(title:paris OR description:paris) AND records_count >= 50000
    

    One of the major feature of the query language is to allow per field filtering. You can use field names as a prefix to your queries to filter the results based on a specific field's value.

    For the dataset search API, the list of available fields corresponds exactly to available metadata. By default

    Field name Description
    publisher  The dataset publisher
    title The dataset title
    description  The dataset description
    license  The dataset license
    records_count The number of records in the dataset
    modified  The last modification date of the dataset
    language  The language of the dataset (iso code)
    theme The theme of the dataset
    references The references for the dataset

    The domain administrator might define a richer metadata template, thus giving access to a richer set of filtering fields.

    Examples of queries for the record search API

    film_date >= 2002
    film_date >= 2013/02/11
    film_date: [1950 TO 2000]
    film_box_office > 10000 AND film_date < 1965
    

    For the record search API, the list of available fields depends on the schema of the dataset. To fetch the list of available fields for a given dataset, you may use the search dataset or lookup dataset APIs.

    Multiple operator fields can be used between the field name and the query:

    Date formats can be specified in different formats: simple (YYYY[[/mm]/dd]) or ISO 8601 (YYYY-mm-DDTHH:MM:SS)

    Query language functions

    Return all records where birthdate is greater or equal to the current datetime:

    birthdate >= #now()
    

    Return records where birthdate is not set:

    #null(birthdate)
    

    Return records where firstname contains exactly "Marie":

    #exact(firstname, "Marie")
    

    Advanced functions can be used in the query language. Function names need to be prefixed with a sharp (#) sign.

    Function name Description
    now Return the current date. This function should be called as a query value for a field
    null Search for records where no value is defined for the given field
    exact Search for records with a field exactly matching a given value

    Available parameters for the #now function

    #now(years=-1, hours=-1) -> current date minus a year and an hour
    
    #now(year=2001) -> current time, day and month for year 2001
    
    #now(weeks=-2, weekday=1) -> Tuesday before last
    #now(weekday=MO(2)) -> Monday after next
    

    Geo Filtering

    Example geo filtering expressions

    geofilter.distance=48.8520930694,2.34738897685,1000
    geofilter.polygon=(48.883086, 2.379072), (48.879022, 2.379930), (48.883651, 2.386968)
    

    Records search APIs accept geofilter parameters to filter in records which are located in a specific geographical area.

    The following parameters may be used.

    Parameter Name Description
    geofilter.distance Limit the result set to a geographical area defined by a circle center (WGS84) and radius (in meters): latitude, longitude, distance
    geofilter.polygon Limit the result set to a geographical area defined by a polygon (points expressed in WGS84): ((lat1, lon1), (lat2, lon2), (lat3, lon3))

    Using facets

    A facet can be considered as a valued tag associated with a record. For instance, let's say a dataset has a facet "City". A record in this dataset could have the value "Paris" for the "City" facet.

    Facets are for instance used for building the left navigation column, both for dataset catalog exploration page and dataset records exploration page.

    Facets are especially useful to implement guided navigation in large result sets.

    Identifying facets

    By default, in dataset and record APIs, faceting is disabled. Faceting can be enabled by using the "facet" API parameter, specifying the name of the facet to retrieve.

    In the dataset APIs, facets are the same for all datasets and are the following:

    Facet Name Description
    modified Last modification date
    publisher Producer
    issued First publication date
    accrualperiodicity Publication frequency
    language Language
    license Licence
    granularity Data granularity
    dataquality Data quality
    theme Theme
    keyword Keywords
    created Creation date
    creator Creator
    contributor Contributors

    API response showing fields available as facets

    {
        /* ... */
        "fields": [
            /* ... */
            {
                "label": "City",
                "type": "text",
                "name": "city",
                "annotations": [
                    {
                        "name": "facet"
                    }
                ]
            },
            /* ... */
        ],
        /* ... */
    }
    

    In the records API, facets are defined at field level. A field facet can be available depending on the data producer choices. Fields (retrieved for instance from the Dataset Lookup API) for which faceting is available can be easily identified as shown in the example on the right.

    When faceting is enabled, facets are returned in the response after the result set.

    Every facet has a display value ("name" attribute) and a refine property ("path" attribute) which can be used to alter the query context.

    Example of a facet tree

    "facet_groups": [
        {
            "name": "modified",
            "facets": [
                {
                    "name": "2012",
                    "path": "2012",
                    "facets": [
                        {
                            "name": "09",
                            "path": "2012/09",
                            "facets": [
                                {
                                    "name": "11",
                                    "path": "2012/09/11"
                                }
                                /* ... */
                            ]
                        },
                        /* ... */
                    ]
                },
                /* ... */
            ]
        },
        /* ... */
    ]
    

    Facets are hierarchical, for instance, a year facet will contain months facets and a month facet will contain days facets.

    Example of a facet with all its attributes

    {
        "facet_groups": [
            {
                "name": "modified",
                "count": 822,
                "facets": [
                    {
                        "name": "2013",
                        "path": "2013",
                        "count": 154,
                        "state": "displayed"
                    },
                    {
                        "name": "2014",
                        "path": "2014",
                        "count": 120,
                        "state": "displayed"
                    }
                ]
            }
        ]
    }
    

    Every facet contains two additional information:

    Refining

    Refining on the facet "modified"

    {
        "facet_groups": [
            {
                "name": "modified",
                "count": 462,
                "facets": [
                    {
                        "name": "2013",
                        "path": "2013",
                        "count": 154,
                        "state": "refined",
                        "facets": [
                            {
                                "name": "08",
                                "path": "2013/08",
                                "count": 74,
                                "state": "displayed"
                            },
                            /* ... */
                        ]
                    }
                ]
            }
        ]
    }
    

    It is possible to limit the result set by refining on a given facet value. To do so, use the following API parameter: refine.FACETNAME=FACETVALUE.

    For example: https://public.opendatasoft.com/api/datasets/1.0/search?refine.modified=2013.

    In the returned result set, only the datasets modified in 2013 will be returned.

    As the refinement occurs on the "year" and as the "modified" facet is hierarchical, the sub-level is returned. Results are dispatched in the "month" sub value.

    Excluding

    Using the same principle as above, it is possible to exclude from the result set the hits matching a given value of a given facet. To do so, use the following API parameter: exclude.FACETNAME=FACETVALUE.

    For example: https://public.opendatasoft.com/api/datasets/1.0/search?exclude.modified=2013

    Only results that have not been modified in 2011 will be returned.

    Disjunctive faceting

    By default, faceting is conjunctive. This means that the following context will lead down to no results: https://public.opendatasoft.com/api/datasets/1.0/search?refine.modified=2013&refine.modified=2014.

    You can enable disjunctive faceting using the following API parameter: disjunctive.FACETNAME=true.

    For example: https://public.opendatasoft.com/api/datasets/1.0/search?refine.modified=2013&refine.modified=2014&disjunctive.modified=true

    Dataset Catalog APIs

    Dataset Search API

    GET /api/datasets/1.0/search HTTP/1.1
    

    Example Dataset Search Queries

    https://examples.opendatasoft.com/api/datasets/1.0/search?refine.language=en&refine.modified=2017/10
    https://examples.opendatasoft.com/api/datasets/1.0/search?exclude.publisher=UNESCO&sort=-modified
    

    This API provides a search facility in the dataset catalog. Full text search as well as multi-criteria field queries are made possible and results facetting is provided as well.

    Parameters

    Parameter Description
    q Full-text query performed on the result set
    facet Activate faceting on the specified field (see list of fields in the Query Language section). This parameter can be used multiple times to activate several facets. By default, faceting is disabled
    refine.<FACET> Limit the result set to records where FACET has the specified value. It can be used several times for the same facet or for different facets
    exclude.<FACET> Exclude records where FACET has the specified value from the result set. It can be used several times for the same facet or for different facets
    sort Sorts results by the specified field. By default, the sort is descending. A minus sign - may be used to perform an ascending sort. Sorting is only available on numeric fields (int, double, date and datetime) and on text fields which have the sortable annotation
    rows Number of results to return in a single call. By default, 10 results are returned. While you can request for up to 10 000 results in a row, such requests are not optimal and can be throttled so you should consider splitting them into smaller ones.
    start Index of the first result to return (starting at 0). Use in conjunction with `rows to implement paging
    pretty_print If set to true (default is false), pretty prints JSON and JSONP output
    format Format of the response output. Can be json (default), jsonp, csv or rss
    callback JSONP callback (only in JSONP requests)

    Dataset Lookup API

    GET /api/datasets/1.0/<dataset_id> HTTP/1.1
    

    Example Dataset Lookup API URL

    https://examples.opendatasoft.com/api/datasets/1.0/world-heritage-unesco-list/?pretty_print=true&format=json
    

    Example of JSONP request

    https://examples.opendatasoft.com/api/datasets/1.0/world-heritage-unesco-list/?format=jsonp&callback=myFunction
    

    This API makes it possible to fetch an individual dataset information.

    Parameters

    The dataset identifier is passed as a part of the URL as indicated by the <dataset_id> placeholder in the example on the right.

    Other parameters, passed as query parameters, are described below:

    Parameter Description
    pretty_print If set to true (default is false), pretty prints output
    format Format of the response output. Can be json (default) or jsonp
    callback JSONP callback (only in JSONP requests)

    Dataset Records APIs

    Record Search API

    GET /api/records/1.0/search HTTP/1.1
    

    This API makes it possible to perform complex queries on the records of a dataset, such as full-text search or geo filtering.

    It also provides faceted search features on dataset records.

    Parameters

    Parameter Description
    dataset Identifier of the dataset. This parameter is mandatory
    q Full-text query performed on the result set
    geofilter.distance Limit the result set to a geographical area defined by a circle center (WGS84) and radius (in meters): latitude, longitude, distance
    geofilter.polygon Limit the result set to a geographical area defined by a polygon (points expressed in WGS84): ((lat1, lon1), (lat2, lon2), (lat3, lon3))
    facet Activate faceting on the specified field. This parameter can be used multiple times to simultaneously activate several facets. By default, faceting is disabled. Example: facet=city
    refine.<FACET> Limit the result set to records where FACET has the specified value. It can be used several times for the same facet or for different facets
    exclude.<FACET> Exclude records where FACET has the specified value from the result set. It can be used several times for the same facet or for different facets
    fields Restricts field to retrieve. This parameter accepts multiple field names separated by commas. Example: fields=field1,field2,field3
    pretty_print If set to true (default is false), pretty prints JSON and JSONP output
    format Format of the response output. Can be json (default), jsonp, csv, geojson, geojsonp
    callback JSONP or GEOJSONP callback
    sort Sorts results by the specified field (in modified, issued, created and records_count). By default, the sort is descending. A minus sign - may be used to perform an ascending sort
    rows Number of results to return in a single call. By default, 10 results are returned. While you can request for up to 10 000 results in a row, such requests are not optimal and can be throttled so you should consider splitting them into smaller ones or use the Records Download API. Note also that the cumulated value of the parameters start and rows cannot go over 10 000. It means that with the Records Search API, there's no way to access a result with a position greater than 10 000. If however you need to do so, consider again using the Records Download API.
    start Index of the first result to return (starting at 0). Use in conjunction with "rows" to implement paging

    Record Lookup API

    GET /api/datasets/1.0/<dataset_id>/records/<record_id> HTTP/1.1
    

    Example lookup for record ff1f5b718ce2ee87f18dfaf20610f257979f2f4a in dataset world-heritage-unesco-list:

    https://examples.opendatasoft.com/api/datasets/1.0/world-heritage-unesco-list/records/ff1f5b718ce2ee87f18dfaf20610f257979f2f4a
    

    This API makes it possible to fetch an individual record using its identifier (Record ID).

    Parameters

    Parameter Description
    datasetid Part of the URL path. Identifier of the dataset
    recordid Part of the URL path. Identifier of the record
    pretty_print If set to true (default is false), pretty prints JSON and JSONP output
    format Format of the response output. Can be json (default) or jsonp
    callback JSONP callback

    Record Analysis API

    GET /api/records/1.0/analyze HTTP/1.1
    

    This API provides powerful analytics features over a set of selected records.

    It returns analyzed results in light and easy to parse format which can used as an input of modern charting libraries such as Highchart.js or D3.js.

    Parameters

    Filtering parameters

    Count World Heritage Unesco sites in each category, filtered by a polygon in Central Europe:

    https://examples.opendatasoft.com/api/records/1.0/analyze/?dataset=world-heritage-unesco-list&x=category&y.my_count.func=COUNT&geofilter.polygon=(50.0,0.0),(50.0,10.0),(40.0,10.0),(40.0,0.0)
    
    [{
            "x": "Cultural",
            "my_count": 59
        },
        {
            "x": "Natural",
            "my_count": 5
        }
    ]
    
    Parameter Description
    dataset Identifier of the dataset. This parameter is mandatory
    q Full-text query performed on the result set
    geofilter.distance Limit the result set to a geographical area defined by a circle center (WGS84) and radius (in meters): latitude, longitude, distance
    geofilter.polygon Limit the result set to a geographical area defined by a polygon (points expressed in WGS84): ((lat1, lon1), (lat2, lon2), (lat3, lon3))
    refine.<FACET> Limit the result set to records where FACET has the specified value. It can be used several times for the same facet or for different facets
    exclude.<FACET> Exclude records where FACET has the specified value from the result set. It can be used several times for the same facet or for different facets
    pretty_print If set to true (default is false), pretty prints JSON and JSONP output
    format Format of the response output. Can be json (default), jsonp, csv
    callback JSONP callback (only in JSONP requests)

    Aggregation parameters

    Return the area in hectares of the biggest World Heritage Unesco site in each country:

    https://examples.opendatasoft.com/api/records/1.0/analyze/?dataset=world-heritage-unesco-list&x=country_en&y.max_area.func=MAX&y.max_area.expr=area_hectares
    
    [{
            "x": "Afghanistan",
            "max_area": 158.9265
        },
        {
            "x": "Albania",
            "max_area": 58.9
        },
        {
            "x": "Algeria",
            "max_area": 665.03
        },
        /* ... */
        {
            "x": "Zimbabwe",
            "max_area": 676600
        },
        {
            "x": "the Former Yugoslav Republic of Macedonia",
            "max_area": 83350
        }
    ]
    

    Return the count of sites inscribed each month and year:

    https://examples.opendatasoft.com/api/records/1.0/analyze/?dataset=world-heritage-unesco-list&x=date_inscribed&periodic=year&precision=month&y.another_count.func=COUNT
    
    [{
            "x": {
                "month": 1,
                "year": 1978
            },
            "another_count": 12
        },
        /* ... */
        {
            "x": {
                "month": 1,
                "year": 1980
            },
            "another_count": 27
        }
    ]
    
    Parameter Description
    x Field on which the data aggregation will be based. This parameter is mandatory. It allows for analyzing a subset of data according to the different values of the fields. The behavior may vary according to the field type. For Date and DateTime fields, the slices are built from the dates using the level of aggregation defined through the precision and periodic parameters. For other field types, the actual field values are used as x values
    y.<SERIE>.func The definition of the analysis aggregation function. Multiple series can be computed at once, simply name this parameter with an arbitrary serie name that you may reuse for specifying the associated aggregated expression. The list of available aggregation functions is: COUNT , AVG , SUM , MIN , MAX , STDDEV , SUMSQUARES . These functions return the result of their execution on the expression provided in y..expr (or simply the number of records for the COUNT function) for each value of x
    y.<SERIE>.expr Defines the value to be aggregated. This parameter is mandatory for every aggregation function but the COUNT function. The parameter must have the same name as the one used for the required corresponding aggregation function. The parameter may contain the name of a numeric field in the Dataset (Int or Double), or a mathematical expression (see below to get more details on the expression language).
    y.<SERIE>.cumulative This parameter accepts values true and false (default). If the parameter is set to true, the results of a series are recursively summed up (serie(x) = serie(x) + serie(x-1) )
    maxpoints Limits the maximum number of results returned in the serie. By default there is no limit
    periodic Used only in cases in which x is of type Date or DateTime. It defines the level at which aggregation is done. Possible values are year (default), month , week , weekday , day , hour , minute . This parameter will allow you, for instance, to compute aggregations on months across all years. For instance, with a value set to weekday , the output will be: [{"x": {"weekday":0},"series1": 12}, {"x": {"weekday":1},"series1": 30}] . When weekday is used, the generated value range from 0 to 6 where 0 corresponds to Monday and 6 to Sunday
    precision Used only in cases in which X is of type Date or DateTime. It defines the precision of the aggregation. Possible values are year , month , week , day (default), hour , minute . If weekday is provided as a periodic parameter, the precision parameter is ignored. This parameter shall respect the precision annotation of the field. If the field is annotated with a precision set to day , the serie precision can at maximum be set to day
    sort Sorts the aggregation values according to the specified series, or to the x parameter. By default, the values are sorted in descending order, according to the x parameter. A minus sign ('-') can however be prepended to the argument to make an ascending sort

    Expression language

    Return the average value of twice the sinus of the areas for each category (for the sake of example):

    https://examples.opendatasoft.com/api/records/1.0/analyze/?dataset=world-heritage-unesco-list&x=category&y.series1.func=AVG&y.series1.expr=sin(area_hectares)*2
    
    [{
            "x": "Cultural",
            "series1": 0.06208366995525825
        },
        {
            "x": "Mixed",
            "series1": 0.47869568886889907
        },
        {
            "x": "Natural",
            "series1": 0.018136045219311035
        }
    ]
    

    An arbitrary expression can be used as the value of the definition of an aggregated.

    Records Download API

    GET /api/records/1.0/download HTTP/1.1
    

    This API provides an efficient way to download a large set of records out of a dataset. The HTTP answer is streamed which makes it possible to optimize the memory consumption client side.

    Parameters

    Parameter Description
    dataset Identifier of the dataset. This parameter is mandatory
    q Full-text query performed on the result set
    geofilter.distance Limit the result set to a geographical area defined by a circle center (WGS84) and radius (in meters): latitude, longitude, distance
    geofilter.polygon Limit the result set to a geographical area defined by a polygon (points expressed in WGS84): ((lat1, lon1), (lat2, lon2), (lat3, lon3))
    facet Activate faceting on the specified field. This parameter can be used multiple times to simultaneously activate several facets. By default, faceting is disabled. Example: facet=city
    refine.<FACET> Limit the result set to records where FACET has the specified value. It can be used several times for the same facet or for different facets
    exclude.<FACET> Exclude records where FACET has the specified value from the result set. It can be used several times for the same facet or for different facets
    fields Restricts field to retrieve. This parameter accepts multiple field names separated by commas. Example: fields=field1,field2,field3
    pretty_print If set to true (default is false), pretty prints JSON and JSONP output
    format Format of the response output. Can be json (default), jsonp, csv, geojson, geojsonp
    callback JSONP or GEOJSONP callback

    Records Geo Clustering API

    GET /api/records/1.0/geocluster HTTP/1.1
    

    This API provides powerful geo clustering features over a set of selected records.

    The return format can easily be used to build comprehensive data visualizations on a map, using a very large number of records.

    This API takes as an input:

    It returns a list of clusters with the number of points contained in each cluster and the polygon of the cluster envelope, along with computed aggregations when required.

    The clustering results are returned in JSON.

    Filtering parameters

    Parameter Description
    dataset Identifier of the dataset. This parameter is mandatory
    q Full-text query performed on the result set
    geofilter.distance Limit the result set to a geographical area defined by a circle center (WGS84) and radius (in meters): latitude, longitude, distance
    geofilter.polygon Limit the result set to a geographical area defined by a polygon (points expressed in WGS84): ((lat1, lon1), (lat2, lon2), (lat3, lon3))
    facet Activate faceting on the specified field. This parameter can be used multiple times to simultaneously activate several facets. By default, faceting is disabled. Example: facet=city
    refine.<FACET> Limit the result set to records where FACET has the specified value. It can be used several times for the same facet or for different facets
    exclude.<FACET> Exclude records where FACET has the specified value from the result set. It can be used several times for the same facet or for different facets
    fields Restricts field to retrieve. This parameter accepts multiple field names separated by commas. Example: fields=field1,field2,field3
    pretty_print If set to true (default is false), pretty prints JSON and JSONP output
    format Format of the response output. Can be json (default), jsonp, csv, geojson, geojsonp
    callback JSONP or GEOJSONP callback

    Clustering parameters

    Return clusters and shapes with low precision and the average area in each cluster

    https://examples.opendatasoft.com/api/records/1.0/geocluster/?dataset=world-heritage-unesco-list&shapeprecision=1&clusterprecision=3&y.avg_area.func=AVG&y.avg_area.expr=area_hectares```
    
    {
        "clusters": [{
                "cluster_center": [
                    10.523538180927272, -60.95864515091818
                ],
                "cluster": {
                    "type": "Polygon",
                    "coordinates": [
                        [[-62.00833333, -2.333333333],[-66.89068,10.49073],[-66.125,18.46666667],[-61.7616666667,17.0069444444],[-55.15,5.82611],[-56.5,4],[-62.00833333, -2.333333333]]
                    ]
                },
                "count": 11,
                "series": {
                    "avg_area": 917952.2154545453
                }
            },
            /* ... */
            {
                "cluster_center": [
                    49.942863890000005, -55.08576666776667
                ],
                "cluster": {
                    "type": "Polygon",
                    "coordinates": [
                        [[-53.2111111111, 46.635],[-56.4295222222, 51.726925],[-55.61666667, 51.46666667],[-53.2111111111, 46.635]]
                    ]
                },
                "count": 3,
                "series": {
                    "avg_area": 2838.3243333333335
                }
            }
        ],
        "count": {
            "max": 137,
            "min": 1
        },
        "series": {
            "avg_area": {
                "max": 40825000,
                "min": 0
            }
        },
        "clusterprecision": 3
    }
    
    Parameter Description
    clusterprecision The desired precision level, depending on the current map zoom level (for example, the Leaflet zoom level). This parameter is mandatory
    shapeprecision The precision of the returned cluster envelope. The sum of clusterprecision and shapeprecision must not exceed 29
    clustermode The desired clustering mode. Supported values are polygon (default) and heatmap
    y.<SERIE>.func, y.<SERIE>.expr This API also accepts a serie definition as described in the record analysis API. If a serie is defined, the aggregation will be performed using the values of the serie