Edit description

PUT /core/v1/{project}/{language}/page/{title}/description

Edits or creates a page description. A page description is a short, plain-text phrase summarizing the page’s topic. Most Wikimedia projects get page descriptions from the corresponding topic on Wikidata, a free repository of structured knowledge. By editing or creating page descriptions via the API, you agree to license your contributions under the Wikidata license, CC0 1.0 Universal Public Domain.

Note: Since English Wikipedia maintains page descriptions locally instead of getting them from Wikidata, page descriptions contributed to English Wikipedia are licensed under Creative Commons Attribution-ShareAlike 3.0 Unported License.

Examples

curl

# Update the description for a user sandbox page on English Wikipedia
$ curl -X PUT https://api.wikimedia.org/core/v1/wikipedia/en/page/User%3AYOUR_USERNAME%2Fsandbox/description \
-H "Content-Type: application/json" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
--data '{"description": "User sandbox page for YOUR_USERNAME", "comment": "Testing out the Wikimedia API"}'

Python

# Python 3
# Update the description for a user sandbox page on English Wikipedia

import requests
import json

url = 'https://api.wikimedia.org/core/v1/wikipedia/en/page/User%3AYOUR_USERNAME%2Fsandbox/description'
request_data = {
    'description': 'User sandbox page for YOUR_USERNAME',
    'comment': 'Testing out the Wikimedia API',
}

headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'User-Agent': 'YOUR_APP_NAME (YOUR_EMAIL_OR_CONTACT_PAGE)'
}

response = requests.put( url, headers=headers, data=json.dumps(request_data) )
output = response.json()
print(output)

PHP

<?php
// Update the description for a user sandbox page on English Wikipedia

$url = 'https://api.wikimedia.org/core/v1/wikipedia/en/page/User%3AYOUR_USERNAME%2Fsandbox/description';
$fields = [
    'description' => 'User sandbox page for YOUR_USERNAME',
    'comment' => 'Testing out the Wikimedia API'
];
$json = json_encode( $fields );

$token = 'YOUR_ACCESS_TOKEN';
$authorization = 'Authorization: Bearer ' . $token;

$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'PUT' );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $json );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json' , $authorization ));
curl_setopt( $ch, CURLOPT_USERAGENT, 'YOUR_APP_NAME (YOUR_EMAIL_OR_CONTACT_PAGE)' );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$output = curl_exec( $ch );
curl_close( $ch );
echo( $output );
?>

JavaScript

// Update the description for a user sandbox page on English Wikipedia

let url = 'https://api.wikimedia.org/core/v1/wikipedia/en/page/User%3AYOUR_USERNAME%2Fsandbox/description';
let response = await fetch( url,
    {
        method: 'PUT',
        headers: {
            'Content-Type': 'application/json',
            'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
            'Api-User-Agent': 'YOUR_APP_NAME (YOUR_EMAIL_OR_CONTACT_PAGE)'
        },
        body: JSON.stringify({
            'description': 'User sandbox page for YOUR_USERNAME',
            'comment': 'Testing out the Wikimedia API'
        })
    }
);
response.json()
    .then(console.log).catch(console.error);

Parameters

project

required path

Project name. For example: wikipedia (encyclopedia articles), commons (images, audio, and video), wiktionary (dictionary entries). List all projects.
language

required path

Language code. For example: ar (Arabic), en (English), es (Spanish). List supported languages.
Note: This endpoint does not support commons or other multilingual projects.
title

required string

Wiki page title with spaces replaced with underscores

Request schema

description

required string

Short page description in plain text
comment

optional string

Reason for editing the description

Headers

Content-Type

required

Specify application/json as the content type.
Authorization

required

Include an access token using the Bearer authentication scheme. For more information about obtaining an access token, visit Authentication.
Accept-Language

optional

Some Wikimedia projects include content in more than one script. For example, Kurdish Wikipedia includes content in both Latin and Arabic scripts. For languages that support multiple scripts, use this header to specify the script. For example, Accept-Language: ku-arab to request the Kurdish language in Arabic script. Defaults to the wiki's primary script.
Supported languages
Language (local) Language (English) Code Variant Code
Qırımtatarca Crimean Tatar crh Latin latn
Cyrillic cyrl
贛語 Gan gan Simplified hans
Traditional hant
ᐃᓄᒃᑎᑐᑦ Inuktitut iu Latin latn
Syllabics cans
Қазақша Kazakh kk Latin latn
Cyrillic cyrl
Arabic arab
Kurdî / كوردی Kurdish ku Latin latn
Arabic arab
Српски / Srpski Serbian sr Latin el
Cyrillic ec
Тоҷикӣ Tajik tg Latin latn
Cyrillic cyrl
O‘zbek Uzbek uz Latin latin
Cyrillic cyrl
中文 Chinese zh Simplified zh-hans
Simplified, China zh-cn
Simplified, Singapore zh-sg
Simplified, Malaysia zh-my
Traditional hant
Traditional, Taiwan zh-tw
Traditional, Hong Kong zh-hk
Traditional, Macau zh-mo

Responses

201 Success: Description updated. Returns the description property.
Example
{
  "description": "User sandbox page for YOUR_USERNAME"
}
401 Error: Missing token. Include an access token in an Authorization request header using the Bearer authentication scheme.
Example
{
  "httpCode": 401,
  "httpReason": "Jwt is missing"
}