JSON need quotes!
[akkoma] / docs / api / pleroma_api.md
1 # Pleroma API
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 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`.
6
7 ## `/api/pleroma/emoji`
8 ### Lists the custom emoji on that server.
9 * Method: `GET`
10 * Authentication: not required
11 * Params: none
12 * Response: JSON
13 * 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"}`
14 * Note: Same data as Mastodon API’s `/api/v1/custom_emojis` but in a different format
15
16 ## `/api/pleroma/follow_import`
17 ### Imports your follows, for example from a Mastodon CSV file.
18 * Method: `POST`
19 * Authentication: required
20 * Params:
21 * `list`: STRING or FILE containing a whitespace-separated list of accounts to follow
22 * Response: HTTP 200 on success, 500 on error
23 * Note: Users that can't be followed are silently skipped.
24
25 ## `/api/pleroma/captcha`
26 ### Get a new captcha
27 * Method: `GET`
28 * Authentication: not required
29 * Params: none
30 * Response: Provider specific JSON, the only guaranteed parameter is `type`
31 * Example response: `{"type": "kocaptcha", "token": "whatever", "url": "https://captcha.kotobank.ch/endpoint"}`
32
33 ## `/api/pleroma/delete_account`
34 ### Delete an account
35 * Method `POST`
36 * Authentication: required
37 * Params:
38 * `password`: user's password
39 * Response: JSON. Returns `{"status": "success"}` if the deletion was successful, `{"error": "[error message]"}` otherwise
40 * Example response: `{"error": "Invalid password."}`
41
42 ## `/api/account/register`
43 ### Register a new user
44 * Method `POST`
45 * Authentication: not required
46 * Params:
47 * `nickname`
48 * `fullname`
49 * `bio`
50 * `email`
51 * `password`
52 * `confirm`
53 * `captcha_solution`: optional, contains provider-specific captcha solution,
54 * `captcha_token`: optional, contains provider-specific captcha token
55 * `token`: invite token required when the registrations aren't public.
56 * Response: JSON. Returns a user object on success, otherwise returns `{"error": "error_msg"}`
57 * Example response:
58 ```
59 {
60 "background_image": null,
61 "cover_photo": "https://pleroma.soykaf.com/images/banner.png",
62 "created_at": "Tue Dec 18 16:55:56 +0000 2018",
63 "default_scope": "public",
64 "description": "blushy-crushy fediverse idol + pleroma dev\nlet's be friends \nぷれろまの生徒会長。謎の外人。日本語OK. \n公主病.",
65 "description_html": "blushy-crushy fediverse idol + pleroma dev.<br />let's be friends <br />ぷれろまの生徒会長。謎の外人。日本語OK. <br />公主病.",
66 "favourites_count": 0,
67 "fields": [],
68 "followers_count": 0,
69 "following": false,
70 "follows_you": false,
71 "friends_count": 0,
72 "id": 6,
73 "is_local": true,
74 "locked": false,
75 "name": "lain",
76 "name_html": "lain",
77 "no_rich_text": false,
78 "pleroma": {
79 "tags": []
80 },
81 "profile_image_url": "https://pleroma.soykaf.com/images/avi.png",
82 "profile_image_url_https": "https://pleroma.soykaf.com/images/avi.png",
83 "profile_image_url_original": "https://pleroma.soykaf.com/images/avi.png",
84 "profile_image_url_profile_size": "https://pleroma.soykaf.com/images/avi.png",
85 "rights": {
86 "delete_others_notice": false
87 },
88 "screen_name": "lain",
89 "statuses_count": 0,
90 "statusnet_blocking": false,
91 "statusnet_profile_url": "https://pleroma.soykaf.com/users/lain"
92 }
93 ```
94
95 ## `/api/pleroma/admin/`…
96 See [Admin-API](Admin-API.md)
97
98 ## `/api/v1/pleroma/flavour/:flavour`
99 * Method `POST`
100 * Authentication: required
101 * Response: JSON string. Returns the user flavour or the default one on success, otherwise returns `{"error": "error_msg"}`
102 * Example response: "glitch"
103 * Note: This is intended to be used only by mastofe
104
105 ## `/api/v1/pleroma/flavour`
106 * Method `GET`
107 * Authentication: required
108 * Response: JSON string. Returns the user flavour or the default one.
109 * Example response: "glitch"
110 * Note: This is intended to be used only by mastofe
111
112 ## `/api/pleroma/notifications/read`
113 ### Mark a single notification as read
114 * Method `POST`
115 * Authentication: required
116 * Params:
117 * `id`: notification's id
118 * Response: JSON. Returns `{"status": "success"}` if the reading was successful, otherwise returns `{"error": "error_msg"}`
119
120 ## `/api/v1/pleroma/accounts/:id/subscribe`
121 ### Subscribe to receive notifications for all statuses posted by a user
122 * Method `POST`
123 * Authentication: required
124 * Params:
125 * `id`: account id to subscribe to
126 * Response: JSON, returns a mastodon relationship object on success, otherwise returns `{"error": "error_msg"}`
127 * Example response:
128 ```json
129 {
130 "id": "abcdefg",
131 "following": true,
132 "followed_by": false,
133 "blocking": false,
134 "muting": false,
135 "muting_notifications": false,
136 "subscribing": true,
137 "requested": false,
138 "domain_blocking": false,
139 "showing_reblogs": true,
140 "endorsed": false
141 }
142 ```
143
144 ## `/api/v1/pleroma/accounts/:id/unsubscribe`
145 ### Unsubscribe to stop receiving notifications from user statuses
146 * Method `POST`
147 * Authentication: required
148 * Params:
149 * `id`: account id to unsubscribe from
150 * Response: JSON, returns a mastodon relationship object on success, otherwise returns `{"error": "error_msg"}`
151 * Example response:
152 ```json
153 {
154 "id": "abcdefg",
155 "following": true,
156 "followed_by": false,
157 "blocking": false,
158 "muting": false,
159 "muting_notifications": false,
160 "subscribing": false,
161 "requested": false,
162 "domain_blocking": false,
163 "showing_reblogs": true,
164 "endorsed": false
165 }
166 ```