test
Nick Grabowski1. Methods
- createAccount
- createPage
- editAccountInfo
- editPage
- getAccountInfo
- getPage
- getPageList
- getViews
- revokeAccessToken
2. Types
3. Content format
Available methods
We support GET and POST HTTP methods. The response contains a JSON object, which always has a Boolean field ok
. If ok
equals true, the request was successful, and the result of the query can be found in the result
field. In case of an unsuccessful request, ok
equals false, and the error is explained in the error
field (e.g. SHORT_NAME_REQUIRED). All queries must be made using UTF-8.
createAccount
Use this method to create a new Telegraph account. Most users only need one account, but this can be useful for channel administrators who would like to keep individual author names and profile links for each of their channels. On success, returns an Account object with the regular fields and an additional access_token
field.
- short_name (String, 1-32 characters)
Required. Account name, helps users with several accounts remember which they are currently using. Displayed to the user above the "Edit/Publish" button on Telegra.ph, other users don't see this name. - author_name (String, 0-128 characters)
Default author name used when creating new articles. - author_url (String, 0-512 characters)
Default profile link, opened when users click on the author's name below the title. Can be any link, not necessarily to a Telegram profile or channel.
Sample request
https://api.telegra.ph/createAccount?short_name=Sandbox&author_name=Anonymous
editAccountInfo
Use this method to update information about a Telegraph account. Pass only the parameters that you want to edit. On success, returns an Account object with the default fields.
- access_token (String)
Required. Access token of the Telegraph account. - short_name (String, 1-32 characters)
New account name. - author_name (String, 0-128 characters)
New default author name used when creating new articles. - author_url (String, 0-512 characters)
New default profile link, opened when users click on the author's name below the title. Can be any link, not necessarily to a Telegram profile or channel.
Sample request
https://api.telegra.ph/editAccountInfo?access_token=b968da509bb76866c35425099bc0989a5ec3b32997d55286c657e6994bbb&short_name=Sandbox&author_name=Anonymous
getAccountInfo
Use this method to get information about a Telegraph account. Returns an Account object on success.
- access_token (String)
Required. Access token of the Telegraph account. - fields (Array of String, default = [“short_name”,“author_name”,“author_url”])
List of account fields to return. Available fields: short_name, author_name, author_url, auth_url, page_count.
Sample request
https://api.telegra.ph/getAccountInfo?access_token=b968da509bb76866c35425099bc0989a5ec3b32997d55286c657e6994bbb&fields=["short_name","page_count"]
revokeAccessToken
Use this method to revoke access_token and generate a new one, for example, if the user would like to reset all connected sessions, or you have reasons to believe the token was compromised. On success, returns an Account object with new access_token
and auth_url
fields.
- access_token (String)
Required. Access token of the Telegraph account.
Sample request
https://api.telegra.ph/revokeAccessToken?access_token=b968da509bb76866c35425099bc0989a5ec3b32997d55286c657e6994bbb