[#534] Merged `upstream/develop`.
[akkoma] / docs / Pleroma-API.md
1 # Authentication
2
3 Requests that require it can be authenticated with [an OAuth token](https://tools.ietf.org/html/rfc6749), the `_pleroma_key` cookie, or [HTTP Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization).
4
5 # Request parameters
6
7 Request parameters can be passed via [query strings](https://en.wikipedia.org/wiki/Query_string) or as [form data](https://www.w3.org/TR/html401/interact/forms.html). Files must be uploaded as `multipart/form-data`.
8
9 # Endpoints
10
11 ## `/api/pleroma/emoji`
12 ### Lists the custom emoji on that server.
13 * Method: `GET`
14 * Authentication: not required
15 * Params: none
16 * Response: JSON
17 * Example response: `{"kalsarikannit_f":"/finmoji/128px/kalsarikannit_f-128.png","perkele":"/finmoji/128px/perkele-128.png","blobdab":"/emoji/blobdab.png","happiness":"/finmoji/128px/happiness-128.png"}`
18 * Note: Same data as Mastodon API’s `/api/v1/custom_emojis` but in a different format
19
20 ## `/api/pleroma/follow_import`
21 ### Imports your follows, for example from a Mastodon CSV file.
22 * Method: `POST`
23 * Authentication: required
24 * Params:
25 * `list`: STRING or FILE containing a whitespace-separated list of accounts to follow
26 * Response: HTTP 200 on success, 500 on error
27 * Note: Users that can't be followed are silently skipped.
28
29 ## `/api/pleroma/captcha`
30 ### Get a new captcha
31 * Method: `GET`
32 * Authentication: not required
33 * Params: none
34 * Response: Provider specific JSON, the only guaranteed parameter is `type`
35 * Example response: `{"type": "kocaptcha", "token": "whatever", "url": "https://captcha.kotobank.ch/endpoint"}`
36
37 ## `/api/pleroma/delete_account`
38 ### Delete an account
39 * Method `POST`
40 * Authentication: required
41 * Params:
42 * `password`: user's password
43 * Response: JSON. Returns `{"status": "success"}` if the deletion was successful, `{"error": "[error message]"}` otherwise
44 * Example response: `{"error": "Invalid password."}`
45
46 ## `/api/account/register`
47 ### Register a new user
48 * Method `POST`
49 * Authentication: not required
50 * Params:
51 * `nickname`
52 * `fullname`
53 * `bio`
54 * `email`
55 * `password`
56 * `confirm`
57 * `captcha_solution`: optional, contains provider-specific captcha solution,
58 * `captcha_token`: optional, contains provider-specific captcha token
59 * Response: JSON. Returns a user object on success, otherwise returns `{"error": "error_msg"}`
60 * Example response:
61 ```
62 {
63 "background_image": null,
64 "cover_photo": "https://pleroma.soykaf.com/images/banner.png",
65 "created_at": "Tue Dec 18 16:55:56 +0000 2018",
66 "default_scope": "public",
67 "description": "blushy-crushy fediverse idol + pleroma dev\nlet's be friends \nぷれろまの生徒会長。謎の外人。日本語OK. \n公主病.",
68 "description_html": "blushy-crushy fediverse idol + pleroma dev.<br />let's be friends <br />ぷれろまの生徒会長。謎の外人。日本語OK. <br />公主病.",
69 "favourites_count": 0,
70 "fields": [],
71 "followers_count": 0,
72 "following": false,
73 "follows_you": false,
74 "friends_count": 0,
75 "id": 6,
76 "is_local": true,
77 "locked": false,
78 "name": "lain",
79 "name_html": "lain",
80 "no_rich_text": false,
81 "pleroma": {
82 "tags": []
83 },
84 "profile_image_url": "https://pleroma.soykaf.com/images/avi.png",
85 "profile_image_url_https": "https://pleroma.soykaf.com/images/avi.png",
86 "profile_image_url_original": "https://pleroma.soykaf.com/images/avi.png",
87 "profile_image_url_profile_size": "https://pleroma.soykaf.com/images/avi.png",
88 "rights": {
89 "delete_others_notice": false
90 },
91 "screen_name": "lain",
92 "statuses_count": 0,
93 "statusnet_blocking": false,
94 "statusnet_profile_url": "https://pleroma.soykaf.com/users/lain"
95 }
96 ```
97
98 ## `/api/pleroma/admin/`…
99 See [Admin-API](Admin-API.md)