Check provides a powerful API for the partners to push the data they want to see in their workspaces. This article whose primary audience is software developers and other geeky folks describes how to authenticate with our API and create content in Check such as Media and Fact-Check articles.
Our API leverages GraphQL, an efficient query language for APIs that allow requests to specify the data it needs through structured queries and mutations, served by a single API endpoint.
Summary
Authentication
First thing you'll need is to generate an API key for your workspace. To do so, follow these steps:
Go to workspace settings page and click the Integrations tab
Enable API access, then click the New API Key button
Enter a name and description to your new API key and click Generate Key
Now you should be able to send requests to the Check API, let's try that with a simple query:
curl -X POST \
-H 'X-Check-Token: <your_api_key>' \
-H 'Content-Type: application/json' \
--data '{ "query": "query { me { name } }" }' \
"https://check-api.checkmedia.org/api/graphql"
The server should return with a JSON data structure containing your API key name:
{"data":{"me":{"name":"My API Key"}}}
Creating Media items
To submit the media content your audience wants verified we'll do a mutation
type of request. Use the sample request from the Authentication example and change the value of the query in the --data
argument for:
mutation {
createProjectMedia(input: {
set_original_claim: "https://example.com/image.jpg"
}) {
project_media {
dbid
full_url
}
}
}
The complete curl request would look like:
curl -X POST \
-H 'X-Check-Token: <your_api_key>' \
-H 'Content-Type: application/json' \
--data '{ "query": "mutation { createProjectMedia(input: { set_original_claim: \"https://example.com/image.jpg\" }) { project_media { dbid full_url } } }" }' \
"https://check-api.checkmedia.org/api/graphql"
The set_original_claim
field in the input
object accepts a URL or plain text. Sending plain text will create a media of type Text. A URL value will be parsed and will create an item of the corresponding type, as follows:
Image
Audio
Video
Web page
Social media post
Facebook, Instagram, Telegram, Tiktok, X (Twitter), Youtube
A successful request following this example should return something like:
{"data":{"createProjectMedia":{"project_media":{"dbid":123456 "full_url": "https://checkmedia.org/your-workspace/media/123456"}}}}
Where dbid
is the id of the media just created in your workspace, and full_url
is the direct link to the new media item in Check.
Create a Claim & Fact-Check Article
A Claim & Fact-Check article requires the following data to be created:
Claim title
Fact-Check title
Fact-Check summary
Language
Here's a sample mutation:
mutation {
createProjectMedia(input: {
media_type: "Blank",
set_claim_description: "Earth is round.",
set_fact_check: {
title: "TRUE: The Earth is round",
summary: "Scientific evidences show that the Earth is round.",
language: "en", # Must be the ISO-361 code of a language supported by the workspace
}
}) {
project_media {
claim_description {
fact_check {
dbid
}
}
}
}
}
And the corresponding curl request:
curl -X POST \
-H 'X-Check-Token: <your_api_key>' \
-H 'Content-Type: application/json' \
--data '{ "query": "mutation { createProjectMedia(input: { media_type: \"Blank\", set_claim_description: \"Earth is round.\", set_fact_check: { title: \"TRUE: The Earth is round\", summary: \"Scientific evidences show that the Earth is round.\", language: \"en\" } }) { project_media { claim_description { fact_check { dbid } } } } }" }' \
"https://check-api.checkmedia.org/api/graphql"
The server response should be:
{"data":{"createProjectMedia":{"project_media":{"claim_description":{"fact_check":{"dbid":123456}}}}}}
Where dbid
is the id of the Fact-Check article just created in your workspace.
Create an Explainer Article
An Explainer article requires the following data to be created:
Explainer title
Explainer summary
Here's a sample mutation:
mutation {
mutation createExplainer {
createExplainer(input: {
title: "New explainer title",
description: "New explainer summary",
url: "https://explainer.url/", # Optional
language: "en", # Must be the ISO-361 code of a language supported by the workspace (optional)
tags: ["tag1", "tag2"] # Optional
}) {
explainer {
dbid
}
}
}
The server response should be:
{
"data": {
"createExplainer": {
"explainer": {
"dbid": 123456
}
}
}
}
Where dbid
is the id of the Explainer article just created in your workspace.