Skip to content
Scrappa Get API key
Wikipedia API 1 credit/request

Wikipedia Article

GET https://scrappa.co/api/wikipedia/article?title=Albert+Einstein&language=en

Returns one Wikipedia article: page id, title, canonical URL, short description, Wikidata id, disambiguation flag, summary, the full plain text, sections, infobox as label and value pairs (empty when the article has none; some languages keep these facts elsewhere), internal links, images with file URLs, external links, categories and language links. Redirects are followed and reported in redirected_from. Missing articles answer 404. Languages: en, de, fr, es, it, pt, nl, ja, ru, pl, sv and zh. Costs 1 credit per successful request.

Wikipedia Article 1 credit/request

Endpoint

Request preview
GET
https://scrappa.co/api/wikipedia/article?title=Albert+Einstein&language=en
Auth header
x-api-key
Cost
1 credit/request
title = Albert Einstein
Response preview
200 OK
{
    "success": true,
    "data": {
        "page_id": 736,
        "title": "Albert Einstein",
        "display_title": "Albert Einstein",
        "url": "https://en.wikipedia.org/wiki/Albert_Einstein",
        "language": "en",
        "description": "German-born theoretical physicist (1879\u20131955)",
        "wikidata_id": "Q937",
        "is_disambiguation": false,
        "text": "...",
        "sections": [
            {
...

Parameters

Start with the required fields, then add optional filters only when your use case needs them.

Runnable path

1 required parameter needed before sending a request.

1 optional filter available.

title string Required

Article title, e.g. Albert Einstein. Redirects are followed.

Example value Albert Einstein
language string Optional

Wikipedia language code: en, de, fr, es, it, pt, nl, ja, ru, pl, sv or zh. Defaults to en.

Example value en

Request Examples

PHP
<?php

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => "https://scrappa.co/api/wikipedia/article?title=Albert+Einstein&language=en",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
        "x-api-key: YOUR_API_KEY_HERE"
    ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #:" . $err;
} else {
    echo $response;
}
PHP
<?php

use Illuminate\Support\Facades\Http;

$response = Http::timeout(30)
    ->withHeaders(['x-api-key' => 'YOUR_API_KEY_HERE'])
    ->get('https://scrappa.co/api/wikipedia/article?title=Albert+Einstein&language=en');

if ($response->successful()) {
    echo $response->body();
} else {
    echo "Error: " . $response->status();
}
JavaScript
const options = {
    method: 'GET',
    headers: {
        'x-api-key': 'YOUR_API_KEY_HERE'
    }
};

fetch('https://scrappa.co/api/wikipedia/article?title=Albert+Einstein&language=en', options)
    .then(response => {
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        return response.text();
    })
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
JavaScript
const axios = require('axios');

const options = {
    method: 'GET',
    url: 'https://scrappa.co/api/wikipedia/article?title=Albert+Einstein&language=en',
    headers: {
        x-api-key: 'YOUR_API_KEY_HERE',
    }
};

try {
    const response = await axios(options);
    console.log(response.data);
} catch (error) {
    console.error('Error:', error.message);
}
Ruby
require 'net/http'
require 'uri'

uri = URI.parse("https://scrappa.co/api/wikipedia/article?title=Albert+Einstein&language=en")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == 'https'

request = Net::HTTP::Get.new(uri.request_uri)
request['x-api-key'] = 'YOUR_API_KEY_HERE'

begin
    response = http.request(request)
    puts response.body
rescue => e
    puts "Error: #{e.message}"
end
Python
import http.client
import json

conn = http.client.HTTPSConnection("scrappa.co")

headers = {
    'x-api-key': 'YOUR_API_KEY_HERE',
}

try:
    conn.request("GET", "/api/wikipedia/article?title=Albert+Einstein&language=en", headers=headers)
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
except Exception as e:
    print(f"Error: {e}")
finally:
    conn.close()
Python
import requests

headers = {
    'x-api-key': 'YOUR_API_KEY_HERE',
}

try:
    response = requests.get('https://scrappa.co/api/wikipedia/article?title=Albert+Einstein&language=en', headers=headers)
    response.raise_for_status()
    print(response.text)
except requests.exceptions.RequestException as e:
    print(f"Error: {e}")
Java
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;

public class ApiExample {
    public static void main(String[] args) {
        OkHttpClient client = new OkHttpClient();

        Request request = new Request.Builder()
            .url("https://scrappa.co/api/wikipedia/article?title=Albert+Einstein&language=en")
        .addHeader("x-api-key", "YOUR_API_KEY_HERE")
            .build();

        try (Response response = client.newCall(request).execute()) {
            if (response.isSuccessful()) {
                System.out.println(response.body().string());
            } else {
                System.out.println("Error: " + response.code());
            }
        } catch (IOException e) {
            System.out.println("Error: " + e.getMessage());
        }
    }
}
Go
package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {
    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://scrappa.co/api/wikipedia/article?title=Albert+Einstein&language=en", nil)
    if err != nil {
        fmt.Println("Error creating request:", err)
        return
    }
    req.Header.Set("x-api-key", "YOUR_API_KEY_HERE")

    resp, err := client.Do(req)
    if err != nil {
        fmt.Println("Error making request:", err)
        return
    }
    defer resp.Body.Close()

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        fmt.Println("Error reading response:", err)
        return
    }

    fmt.Println(string(body))
}
Terminal
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/wikipedia/article?title=Albert+Einstein&language=en"
C#
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        using var client = new HttpClient();
        client.DefaultRequestHeaders.Add("x-api-key", "YOUR_API_KEY_HERE");

        try
        {
            var response = await client.SendAsync(new HttpRequestMessage(HttpMethod.Get, "https://scrappa.co/api/wikipedia/article?title=Albert+Einstein&language=en"));
            var content = await response.Content.ReadAsStringAsync();
            Console.WriteLine(content);
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Error: {ex.Message}");
        }
    }
}
TypeScript
import axios from 'axios';

async function run(): Promise<void> {
    try {
        const response = await axios({
            method: 'GET',
            url: 'https://scrappa.co/api/wikipedia/article?title=Albert+Einstein&language=en',
            headers: {
        'x-api-key': 'YOUR_API_KEY_HERE',
            },
        });

        console.log(response.data);
    } catch (error) {
        console.error('Error:', error);
    }
}

void run();
RUST
use reqwest::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    let response = client
        .get("https://scrappa.co/api/wikipedia/article?title=Albert+Einstein&language=en")
        .header("x-api-key", "YOUR_API_KEY_HERE")
        .send()
        .await?;

    println!("{}", response.text().await?);

    Ok(())
}

Response Schema

Example response fields are illustrative; inspect the JSON before integrating.

Example response fields

Scan these fields before integrating.

success data meta
JSON Response
200 OK
{
    "success": true,
    "data": {
        "page_id": 736,
        "title": "Albert Einstein",
        "display_title": "Albert Einstein",
        "url": "https://en.wikipedia.org/wiki/Albert_Einstein",
        "language": "en",
        "description": "German-born theoretical physicist (1879\u20131955)",
        "wikidata_id": "Q937",
        "is_disambiguation": false,
        "text": "...",
        "sections": [
            {
                "index": 1,
                "level": 2,
                "number": "1",
                "title": "Life and career",
                "anchor": "Life_and_career"
            },
            {
                "index": 2,
                "level": 3,
                "number": "1.1",
                "title": "Childhood, youth and education",
                "anchor": "Childhood,_youth_and_education"
            }
        ],
        "infobox": [
            {
                "label": "Born",
                "value": "(1879-03-14)14 March 1879, Ulm, Kingdom of W\u00fcrttemberg, German Empire"
            },
            {
                "label": "Died",
                "value": "18 April 1955(1955-04-18) (aged 76), Princeton, New Jersey, U.S."
            }
        ],
        "links": [
            {
                "title": "Einstein (disambiguation)",
                "url": "https://en.wikipedia.org/wiki/Einstein_%28disambiguation%29"
            },
            {
                "title": "Albert Einstein (disambiguation)",
                "url": "https://en.wikipedia.org/wiki/Albert_Einstein_%28disambiguation%29"
            }
        ],
        "images": [
            {
                "file": "Symbol support vote.svg",
                "url": "https://en.wikipedia.org/wiki/Special:FilePath/Symbol_support_vote.svg"
            },
            {
                "file": "Semi-protection-shackle.svg",
                "url": "https://en.wikipedia.org/wiki/Special:FilePath/Semi-protection-shackle.svg"
            }
        ],
        "external_links": [
            "https://doi.org/10.1098%2Frsbm.1955.0005",
            "https://www.jstor.org/stable/769242"
        ],
        "categories": [],
        "language_links": [
            {
                "language": "ab",
                "name": "Abkhazian",
                "title": "\u0415\u0438\u043d\u0448\u0442\u0435\u0438\u043d, \u0410\u043b\u0431\u0435\u0440\u0442",
                "url": "https://ab.wikipedia.org/wiki/%D0%95%D0%B8%D0%BD%D1%88%D1%82%D0%B5%D0%B8%D0%BD,_%D0%90%D0%BB%D0%B1%D0%B5%D1%80%D1%82"
            },
            {
                "language": "af",
                "name": "Afrikaans",
                "title": "Albert Einstein",
                "url": "https://af.wikipedia.org/wiki/Albert_Einstein"
            }
        ]
    },
    "meta": {
        "endpoint_family": "article",
        "billable": true
    }
}

Errors

Handle these documented responses before retrying or showing customer-facing failures.

503

Upstream Unavailable

The source could not be fetched after the attempt budget. Never charged. Safe to retry.

{
    "success": false,
    "error": {
        "code": "UPSTREAM_UNAVAILABLE",
        "message": "The source is temporarily unavailable."
    },
    "meta": {
        "billable": false,
        "retryable": true
    }
}
500

Parser Drift

The source returned a shape this parser does not recognise. The incident is reported. Never charged.

{
    "success": false,
    "error": {
        "code": "PARSER_DRIFT",
        "message": "The source response shape changed unexpectedly. The incident has been reported."
    },
    "meta": {
        "billable": false,
        "retryable": false
    }
}
404

Not Found

The source has no such public resource. Never charged.

{
    "success": false,
    "error": {
        "code": "NOT_FOUND",
        "message": "The source has no such public resource."
    },
    "meta": {
        "billable": false,
        "retryable": false
    }
}
422

Invalid Parameter

A value in this request is invalid or the requested page is out of range. Never charged.

{
    "success": false,
    "error": {
        "code": "INVALID_PARAMETER",
        "message": "A value in this request is invalid. Check the parameters before retrying."
    },
    "meta": {
        "billable": false,
        "retryable": false
    }
}

Generate Code with AI

Copy a ready-made prompt with all the endpoint details, parameters, and example responses. Paste it into ChatGPT, Claude, or any AI assistant to instantly generate working code.

Try It Live

Test this endpoint in our interactive playground with real data.