FloodTags API (V2)

Download OpenAPI specification:Download

API to access FloodTags data, meant for the querying, export and editing of 'Tags' and 'Events', for the purpose of visualizing the data and implementing FloodTags data in custom front-end solutions.

Structure

The API consists of the following base endpoints:

  • /tags: Endpoints for querying, exporting and editing 'Tags'. 'Tags' are what we call individual online media reports, such as Tweets, News Articles and Youtube Video's
  • /events: Endpoints for querying, exporting and editing 'Events' that are detected based on online media data. For flood related data sources for example, these are flood-events, which are periods in time in which flooding occured.
  • /user: Endpoints related to retrieving information and authorizations for the currently logged-in user and editing user settings.

If you're looking to develop a custom solution based on the FloodTags API, it may also help to login to the FloodTags Dashboard, and use your browser's developer tools to inspect all requests to api.floodtags.com, to get an idea how the API can be used from a front-end.

Rate-Limits

Note that the API is designed for implementation in front-ends, and rate-limits apply. On average, you should not send more than 1 request every 2 seconds. To receive bulk data, please contact FloodTags at info@floodtags.com

Tags

Query Tags

Query the tags (Tweets, News Articles, Videos etc.) in the FloodTags database, and return the results in one or more representations (views)

Authorizations:
APIKeyAuthenticationSessionBasedAuthentication
query Parameters
views
required
Array of strings non-empty
Items Enum: "tags" "locations" "graph" "counts.words" "counts.hashtags" "counts.author.names" "counts.mentions.cause" "counts.mentions.impact"
Example: views=tags,locations

One or more representations in which to return the queried data. Please see the 'response schema' under the '200' response code below to find a description of each view.

sources
Array of strings non-empty
Example: sources=spanish-flood-news,english-flood-news

The data-sources for which to return data. Find the list of authorized sources for your account at /user?views=sources. (required if 'ids' is not provided)

date.since
string <date-time>
Example: date.since=2020-02-02T12:34:33Z

Beginning of time range for query (including/gte, required if 'event.id' or 'ids' is not provided)

date.until
string <date-time>
Example: date.until=2020-02-02T12:35:33Z

End of time range for query (excluding/lt, required if 'event.id' or 'ids' is not provided)

event.id
string
Example: event.id=ev-992838847739

If given, only tags from this event are queried. In case no start and end-date are given, or these are outside the bounds of this event, the date.since and date.until parameters are automatically set to the start/end of the event

ids
Array of strings <= 50 items
Example: ids=t-123456789,t-987654321-edited-4s3546d6w8

Query for tags with these ids (Note: url parameters, other than views/format-related ones, are ignored)

shareURLIds
Array of strings <= 10000 items
Example: shareURLIds=t-123456789,t-987654321-edited-4s3546d6w8

Filter for ids that are in currently selected shareable URL.

filters
Array of strings
Example: filters=high_keyword_score,class:transport

Filters to apply to the query. Find the list of filters that can be used for each source at /user?views=sources.

contains
Array of strings
Items Enum: "locations" "photos" "waterDepth" "labels" "share-url"

Include only tags that contain these fields

labels
Array of strings
Example: labels=Recent Flood,Damages Mentioned

Query by these user-added labels. Note that if labels contain commas, these should be double encoded (e.g. %252C). To achieve this, first URL encode each label (e.g. with this function, then join the array using comma's, and then URL encode it again.

not.labels
Array of strings
Example: not.labels=Incorrect Location,Unrelated

Filter query results by exluding items that have these user-added labels. The same formatting conventions as for the 'labels' parameter apply.

location.id
string
Example: location.id=g-8837749

Return only data that have a location with this ID

location.bbox
Array of numbers = 4 items
Example: location.bbox=4.17698,52.01303,4.46404,52.11796

Return only data with locations within this bounding box (order:west,south,east,north)

location.parent.id
Array of strings <= 10 items
Example: location.parent.id=g-8839948

Return only items that have locations with either these ids, or one of these IDs in their lists of parent locations

query
string
Example: query=flood | floods | flooding

Full-text query on the text field, in the syntax described here. Note that 'and' is the default operator, and FUZZY, SLOP and NEAR matching are disabled.

author.name
string
Example: author.name=floodtags

Return only tags from an author with this name (e.g. the 'screen name' for Tweets)

source.name
string
Example: source.name=Washington Post

Return only tags originating from the source with the given name

view.graph.interval
string^(\d+(ms|s|m|h|d))|(1(M|q|y))$
Default: "1h"
Example: view.graph.interval=1d

Time interval of graph data in the format described here (views=graph only)

view.tags.limit
integer [ 0 .. 100 ]
Default: 10

The number of results to show per page (views=tags only)

view.tags.skip
integer [ 0 .. 10000 ]
Default: 0

The result at which to start the page (offset, views=tags only)

Responses

Response samples

Content type
application/json
Example
{
  • "status": "success",
  • "total": 1,
  • "errors": [ ],
  • "data": {
    }
}

Export Tags

Export the query results to a CSV or GeoJSON file

Authorizations:
APIKeyAuthenticationSessionBasedAuthentication
query Parameters
sources
Array of strings non-empty
Example: sources=spanish-flood-news,english-flood-news

The data-sources for which to return data. Find the list of authorized sources for your account at /user?views=sources. (required if 'ids' is not provided)

date.since
string <date-time>
Example: date.since=2020-02-02T12:34:33Z

Beginning of time range for query (including/gte, required if 'event.id' or 'ids' is not provided)

date.until
string <date-time>
Example: date.until=2020-02-02T12:35:33Z

End of time range for query (excluding/lt, required if 'event.id' or 'ids' is not provided)

event.id
string
Example: event.id=ev-992838847739

If given, only tags from this event are queried. In case no start and end-date are given, or these are outside the bounds of this event, the date.since and date.until parameters are automatically set to the start/end of the event

ids
Array of strings <= 50 items
Example: ids=t-123456789,t-987654321-edited-4s3546d6w8

Query for tags with these ids (Note: url parameters, other than views/format-related ones, are ignored)

shareURLIds
Array of strings <= 10000 items
Example: shareURLIds=t-123456789,t-987654321-edited-4s3546d6w8

Filter for ids that are in currently selected shareable URL.

filters
Array of strings
Example: filters=high_keyword_score,class:transport

Filters to apply to the query. Find the list of filters that can be used for each source at /user?views=sources.

contains
Array of strings
Items Enum: "locations" "photos" "waterDepth" "labels" "share-url"

Include only tags that contain these fields

labels
Array of strings
Example: labels=Recent Flood,Damages Mentioned

Query by these user-added labels. Note that if labels contain commas, these should be double encoded (e.g. %252C). To achieve this, first URL encode each label (e.g. with this function, then join the array using comma's, and then URL encode it again.

not.labels
Array of strings
Example: not.labels=Incorrect Location,Unrelated

Filter query results by exluding items that have these user-added labels. The same formatting conventions as for the 'labels' parameter apply.

location.id
string
Example: location.id=g-8837749

Return only data that have a location with this ID

location.bbox
Array of numbers = 4 items
Example: location.bbox=4.17698,52.01303,4.46404,52.11796

Return only data with locations within this bounding box (order:west,south,east,north)

location.parent.id
Array of strings <= 10 items
Example: location.parent.id=g-8839948

Return only items that have locations with either these ids, or one of these IDs in their lists of parent locations

query
string
Example: query=flood | floods | flooding

Full-text query on the text field, in the syntax described here. Note that 'and' is the default operator, and FUZZY, SLOP and NEAR matching are disabled.

author.name
string
Example: author.name=floodtags

Return only tags from an author with this name (e.g. the 'screen name' for Tweets)

source.name
string
Example: source.name=Washington Post

Return only tags originating from the source with the given name

format
required
string
Enum: "csv" "geojson"

In which format to export the tag data

Responses

Response samples

Content type
"string"

Edit Tags

Edit tags (Tweets, News Articles, Videos etc.) in the FloodTags system by changing one or more fields of the tag

Authorizations:
APIKeyAuthenticationSessionBasedAuthentication
query Parameters
ids
required
Array of strings <= 50 items
Example: ids=t-123456789,t-987654321-edited-4s3546d6w8

Apply the operation to tags with these ids

Request Body schema: application/json
required

The fields to replace in the body of the tags

non-empty
labels
Array of strings

Array of labels. To delete, send an empty array

waterDepth
number or null

A number in cm to indicate waterdepth. To delete, send null

Array of objects or objects

Array of locations, each one either with only an id, in order to keep an existing location, or with a full geometry and a name, to add a manually defined location

Responses

Request samples

Content type
application/json
{
  • "labels": [
    ],
  • "waterDepth": 30,
  • "locations": [
    ]
}

Response samples

Content type
application/json
Example
{
  • "status": "success",
  • "errors": [ ]
}

Delete Tags

Delete tags (Tweets, News Articles, Videos etc.) from the FloodTags system for your user or user-group

Authorizations:
APIKeyAuthenticationSessionBasedAuthentication
query Parameters
ids
required
Array of strings <= 50 items
Example: ids=t-123456789,t-987654321-edited-4s3546d6w8

Apply the operation to tags with these ids

Responses

Response samples

Content type
application/json
Example
{
  • "status": "success",
  • "errors": [ ]
}

Events

Query Events

Query the events detected by FloodTags, and return the results in one or more representations (views)

Authorizations:
APIKeyAuthenticationSessionBasedAuthentication
query Parameters
views
required
Array of strings non-empty
Items Enum: "events" "locations"
Example: views=events

One or more representations in which to return the queried data. Please see the 'response schema' under the '200' response code below to find a description of each view.

sources
Array of strings non-empty
Example: sources=spanish-flood-news,english-flood-news

The data-sources for which to return data. Find the list of authorized sources for your account at /user?views=sources. (required if 'ids' is not provided)

date.since
string <date-time>
Example: date.since=2020-02-02T12:34:33Z

Beginning of time range for query (including/gte, required if 'ids' is not provided)

date.until
string <date-time>
Example: date.until=2020-02-02T12:35:33Z

End of time range for query (excluding/lt, required if 'ids' is not provided)

ids
Array of strings <= 50 items
Example: ids=ev-123456789,ev-987654321-edited-4s3546d6w8

Query for events with these ids (Note: url parameters, other than views/format-related ones, are ignored)

labels
Array of strings
Example: labels=Recent Flood,Damages Mentioned

Query by these user-added labels. Note that if labels contain commas, these should be double encoded (e.g. %252C). To achieve this, first URL encode each label (e.g. with this function, then join the array using comma's, and then URL encode it again.

not.labels
Array of strings
Example: not.labels=Incorrect Location,Unrelated

Filter query results by exluding items that have these user-added labels. The same formatting conventions as for the 'labels' parameter apply.

location.id
string
Example: location.id=g-8837749

Return only data that have a location with this ID

location.bbox
Array of numbers = 4 items
Example: location.bbox=4.17698,52.01303,4.46404,52.11796

Return only data with locations within this bounding box (order:west,south,east,north)

location.parent.id
Array of strings <= 10 items
Example: location.parent.id=g-8839948

Return only items that have locations with either these ids, or one of these IDs in their lists of parent locations

view.events.limit
integer [ 0 .. 100 ]
Default: 10

The number of results to show per page (Only for tag view)

view.events.skip
integer [ 0 .. 10000 ]
Default: 0

The result at which to start for paging (offset)

Responses

Response samples

Content type
application/json
{
  • "status": "success",
  • "errors": [ ],
  • "total": 1,
  • "data": {
    }
}

Export Events

Export the query results to a CSV or GeoJSON file

Authorizations:
APIKeyAuthenticationSessionBasedAuthentication
query Parameters
sources
Array of strings non-empty
Example: sources=spanish-flood-news,english-flood-news

The data-sources for which to return data. Find the list of authorized sources for your account at /user?views=sources. (required if 'ids' is not provided)

date.since
string <date-time>
Example: date.since=2020-02-02T12:34:33Z

Beginning of time range for query (including/gte, required if 'ids' is not provided)

date.until
string <date-time>
Example: date.until=2020-02-02T12:35:33Z

End of time range for query (excluding/lt, required if 'ids' is not provided)

ids
Array of strings <= 50 items
Example: ids=ev-123456789,ev-987654321-edited-4s3546d6w8

Query for events with these ids (Note: url parameters, other than views/format-related ones, are ignored)

labels
Array of strings
Example: labels=Recent Flood,Damages Mentioned

Query by these user-added labels. Note that if labels contain commas, these should be double encoded (e.g. %252C). To achieve this, first URL encode each label (e.g. with this function, then join the array using comma's, and then URL encode it again.

not.labels
Array of strings
Example: not.labels=Incorrect Location,Unrelated

Filter query results by exluding items that have these user-added labels. The same formatting conventions as for the 'labels' parameter apply.

location.id
string
Example: location.id=g-8837749

Return only data that have a location with this ID

location.bbox
Array of numbers = 4 items
Example: location.bbox=4.17698,52.01303,4.46404,52.11796

Return only data with locations within this bounding box (order:west,south,east,north)

location.parent.id
Array of strings <= 10 items
Example: location.parent.id=g-8839948

Return only items that have locations with either these ids, or one of these IDs in their lists of parent locations

format
required
string
Enum: "csv" "geojson"

In which format to export the event data

Responses

Response samples

Content type
"string"

Edit Events

Edit events in the FloodTags system, by changing/adding one or more fields of an event (Currently only supports adding labels and changing name). Note that after editing, ongoing events are no longer updated (e.g. end-date extended)

Authorizations:
APIKeyAuthenticationSessionBasedAuthentication
query Parameters
ids
required
Array of strings <= 50 items
Example: ids=ev-123456789,ev-987654321-edited-4s3546d6w8

Apply the operation to events with these ids

Request Body schema: application/json
required

The fields to replace in the event data

non-empty
labels
Array of strings
name
string
end
string

Responses

Request samples

Content type
application/json
{
  • "labels": [
    ]
}

Response samples

Content type
application/json
Example
{
  • "status": "success",
  • "errors": [ ],
  • "idUpdates": {
    }
}

Delete Events

Delete events in the FloodTags system (For your user or user-group only)

Authorizations:
APIKeyAuthenticationSessionBasedAuthentication
query Parameters
ids
required
Array of strings <= 50 items
Example: ids=ev-123456789,ev-987654321-edited-4s3546d6w8

Apply the operation to events with these ids

Responses

Response samples

Content type
application/json
Example
{
  • "status": "success",
  • "errors": [ ]
}

User Data

User Data

Get the user-specific data of the current user (user information, settings etc.)

Authorizations:
APIKeyAuthenticationSessionBasedAuthentication
query Parameters
views
required
Array of strings non-empty
Items Enum: "info" "settings.dashboard" "settings.notifications" "settings.custom" "authorization" "sources" "labels.tags" "labels.events" "apikey"
Example: views=info,settings.dashboard

The type of data to return for the user. See response data for details about each

Responses

Response samples

Content type
application/json
{
  • "status": "success",
  • "errors": [ ],
  • "data": {
    }
}

Edit User Data

Edit the user data

Authorizations:
APIKeyAuthenticationSessionBasedAuthentication
query Parameters
operation
string
Default: "update"
Enum: "update" "replace"

Whether the request body should be used to update existing data, or completely replace it. If for example only 'settings.dashboard.defaultQuery' is in the request body, and this is set to 'update', only the lowest level keys that are given inside the 'settings.dashboard.defaultQuery' object are updated in the user data. If this is set to 'replace', the complete 'dashboard.settings' object is replaced, meaning it will only contain the 'defaultQuery' object with the provided contents.

Request Body schema: application/json
required

The fields to replace in the event data

non-empty
object (settingsSchema)

Responses

Request samples

Content type
application/json
{
  • "settings": {
    }
}

Response samples

Content type
application/json
{
  • "status": "success",
  • "errors": [ ]
}

Request Feature

Request specific features and/or configurations from FloodTags

Authorizations:
APIKeyAuthenticationSessionBasedAuthentication
Request Body schema: application/json
required

A JSON object describing the request subject and details

Any of
subject
required
string
Value: "api-key"

The subject of the request

Responses

Request samples

Content type
application/json
{
  • "subject": "additional-sources",
  • "details": "Facebook, Instagram, Youtube"
}

Response samples

Content type
application/json
{
  • "status": "success",
  • "errors": [ ]
}