4 * [Using the APIs](help/api)
8 Friendica provides the following specific endpoints.
10 Authentication is the same as described in [Using the APIs](help/api#Authentication).
14 These endpoints uses the [Friendica API entities](help/API-Entities).
18 ### GET api/externalprofile/show
20 Returns a [Contact](help/API-Entities#Contact) entity for the provided profile URL.
24 - `profileurl`: Profile URL
26 ### GET api/statuses/public_timeline
28 Returns a list of public [Items](help/API-Entities#Item) posted on this node.
29 Equivalent of the local community page.
33 * `count`: Items per page (default: 20)
35 * `since_id`: minimum id
36 * `max_id`: maximum id
37 * `exclude_replies`: don't show replies (default: false)
38 * `conversation_id`: Shows all statuses of a given conversation.
39 * `include_entities`: "true" shows entities for pictures and links (Default: false)
41 #### Unsupported parameters
45 ### GET api/statuses/networkpublic_timeline
47 Returns a list of public [Items](help/API-Entities#Item) this node is aware of.
48 Equivalent of the global community page.
52 * `count`: Items per page (default: 20)
54 * `since_id`: minimum id
55 * `max_id`: maximum id
56 * `exclude_replies`: don't show replies (default: false)
57 * `conversation_id`: Shows all statuses of a given conversation.
58 * `include_entities`: "true" shows entities for pictures and links (Default: false)
60 ### GET api/statuses/replies
64 * `count`: Items per page (default: 20)
66 * `since_id`: minimum id
67 * `max_id`: maximum id
68 * `include_entities`: "true" shows entities for pictures and links (Default: false)
70 #### Unsupported parameters
74 * `contributor_details`
78 ### GET api/conversation/show
80 Unofficial Twitter command. It shows all direct answers (excluding the original post) to a given id.
84 * `id`: id of the post
85 * `count`: Items per page (default: 20)
87 * `since_id`: minimum id
88 * `max_id`: maximum id
89 * `include_entities`: "true" shows entities for pictures and links (Default: false)
91 #### Unsupported parameters
95 * `contributor_details`
97 ### GET api/statusnet/conversation
99 Alias of [`api/conversation/show`](#GET+api%2Fconversation%2Fshow).
101 ### GET api/statusnet/config
103 Returns the public Friendica node configuration.
105 ### GET api/gnusocial/config
107 Alias of [`api/statusnet/config`](#GET+api%2Fstatusnet%2Fconfig).
109 ### GET api/statusnet/version
111 Returns a fake static StatusNet protocol version.
113 ### GET api/gnusocial/version
115 Alias of [`api/statusnet/version`](#GET+api%2Fstatusnet%2Fversion).
119 ### POST api/friendica/activity/[verb]
121 Add or remove an activity from an item.
122 'verb' can be one of:
130 To remove an activity, prepend the verb with "un", eg. "unlike" or "undislike"
131 Attend verbs disable eachother: that means that if "attendyes" was added to an item, adding "attendno" remove previous "attendyes".
132 Attend verbs should be used only with event-related items (there is no check at the moment).
154 ### GET api/direct_messages
156 Deprecated Twitter received direct message list endpoint.
160 * `count`: Items per page (default: 20)
161 * `page`: page number
162 * `since_id`: minimum id
163 * `max_id`: maximum id
164 * `getText`: Defines the format of the status field. Can be "html" or "plain"
165 * `include_entities`: "true" shows entities for pictures and links (Default: false)
166 * `friendica_verbose`: "true" enables different error returns (default: "false")
168 #### Unsupported parameters
172 ### GET api/direct_messages/all
174 Returns all [Private Messages](help/API-Entities#Private+message).
178 * `count`: Items per page (default: 20)
179 * `page`: page number
180 * `since_id`: minimum id
181 * `max_id`: maximum id
182 * `getText`: Defines the format of the status field. Can be "html" or "plain"
183 * `friendica_verbose`: "true" enables different error returns (default: "false")
185 ### GET api/direct_messages/conversation
187 Returns all replies of a single private message conversation. Returns [Private Messages](help/API-Entities#Private+message)
191 * `count`: Items per page (default: 20)
192 * `page`: page number
193 * `since_id`: minimum id
194 * `max_id`: maximum id
195 * `getText`: Defines the format of the status field. Can be "html" or "plain"
196 * `uri`: URI of the conversation
197 * `friendica_verbose`: "true" enables different error returns (default: "false")
199 ### GET api/direct_messages/sent
201 Deprecated Twitter sent direct message list endpoint. Returns [Private Messages](help/API-Entities#Private+message).
205 * `count`: Items per page (default: 20)
206 * `page`: page number
207 * `since_id`: minimum id
208 * `max_id`: maximum id
209 * `getText`: Defines the format of the status field. Can be "html" or "plain"
210 * `include_entities`: "true" shows entities for pictures and links (Default: false)
211 * `friendica_verbose`: "true" enables different error returns (default: "false")
214 ### POST/PUT api/direct_messages/new
216 Deprecated Twitter direct message submission endpoint.
220 * `user_id`: id of the user
221 * `screen_name`: screen name (for technical reasons, this value is not unique!)
222 * `text`: The message
223 * `replyto`: ID of the replied direct message
224 * `title`: Title of the direct message
226 ### POST/DELETE api/direct_messages/destroy
228 Deprecated Twitter direct message deletion endpoint.
232 * `id`: id of the message to be deleted
233 * `include_entities`: optional, currently not yet implemented
234 * `friendica_parenturi`: optional, can be used for increased safety to delete only intended messages
235 * `friendica_verbose`: "true" enables different error returns (default: "false")
241 * JSON return as defined for Twitter API not yet implemented
242 * on friendica_verbose=true: JSON return {"result":"ok","message":"message deleted"}
247 * on friendica_verbose=true: different JSON returns {"result":"error","message":"xyz"}
249 ### GET api/friendica/direct_messages_setseen
253 * `id`: id of the message to be updated as seen
259 * JSON return `{"result": "ok", "message": "message set to seen"}`
263 * different JSON returns `{"result": "error", "message": "xyz"}`
266 ### GET api/friendica/direct_messages_search (GET; AUTH)
268 Returns [Private Messages](help/API-Entities#Private+message) matching the provided search string.
272 * `searchstring`: string for which the API call should search as '%searchstring%' in field 'body' of all messages of the authenticated user (caption ignored)
273 * `getText` (optional): `plain`|`html` If ommited, the title is prepended to the plaintext body in the `text` attribute of the private message objects.
274 * `getUserObjects` (optional): `true`|`false` If `false`, the `sender` and `recipient` attributes of the private message object are absent.
278 Returns only tested with JSON, XML might work as well.
282 * JSON return `{"success":"true", "search_results": array of found messages}`
283 * JSOn return `{"success":"false", "search_results": "nothing found"}`
287 * different JSON returns `{"result": "error", "message": "searchstring not specified"}`
291 ### GET api/friendica/group_show
293 Return all or a specified group of the user with the containing contacts as array.
297 * `gid`: optional, if not given, API returns all groups of the user
303 * `name`: name of the group
304 * `gid`: id of the group
305 * `user`: array of [Contacts](help/API-Entities#Contact)
307 ### POST/PUT api/friendica/group_create
309 Create the group with the posted array of contacts as members.
313 * `name`: name of the group to be created
317 JSON data as Array like the result of [GET api/friendica/group_show](#GET+api%2Ffriendica%2Fgroup_show):
321 * List of [Contacts](help/API-Entities#Contact)
327 * `success`: true if successfully created or reactivated
328 * `gid`: gid of the created group
329 * `name`: name of the created group
330 * `status`: "missing user" | "reactivated" | "ok"
331 * `wrong users`: array of users, which were not available in the contact table
333 ### POST api/friendica/group_update
335 Update the group with the posted array of contacts as members (post all members of the group to the call; function will remove members not posted).
339 * `gid`: id of the group to be changed
340 * `name`: name of the group to be changed
344 JSON data as array like the result of [GET api/friendica/group_show](#GET+api%2Ffriendica%2Fgroup_show):
348 * List of [Contacts](help/API-Entities#Contact)
354 * `success`: true if successfully updated
355 * `gid`: gid of the changed group
356 * `name`: name of the changed group
357 * `status`: "missing user" | "ok"
358 * `wrong users`: array of users, which were not available in the contact table
360 ### POST/DELETE api/friendica/group_delete
362 Delete the specified group of contacts; API call need to include the correct gid AND name of the group to be deleted.
366 * `gid`: id of the group to be deleted
367 * `name`: name of the group to be deleted
373 * `success`: true if successfully deleted
374 * `gid`: gid of the deleted group
375 * `name`: name of the deleted group
376 * `status`: "deleted" if successfully deleted
377 * `wrong users`: empty array
381 ### GET api/friendica/notifications
383 Return last 50 [Notifications](help/API-Entities#Notification) for the current user, ordered by date with unseen item on top.
389 ### POST api/friendica/notifications/seen
391 Set notification as seen.
395 - `id`: id of the notification to set seen
399 If the note is linked to an item, returns an [Item](help/API-Entities#Item).
401 Otherwise, a success status is returned:
403 * `success` (json) | `<status>success</status>` (xml)
407 ### GET api/friendica/photo
409 Returns a [Photo](help/API-Entities#Photo).
413 * `photo_id`: Resource id of a photo.
414 * `scale`: (optional) scale value of the photo
416 Returns data of a picture with the given resource.
417 If 'scale' isn't provided, returned data include full url to each scale of the photo.
418 If 'scale' is set, returned data include image data base64 encoded.
420 possibile scale value are:
422 * 0: original or max size by server settings
423 * 1: image with or height at <= 640
424 * 2: image with or height at <= 320
425 * 3: thumbnail 160x160
426 * 4: Profile image at 300x300
427 * 5: Profile image at 80x80
428 * 6: Profile image at 48x48
430 An image used as profile image has only scale 4-6, other images only 0-3
439 "created": "date(YYYY-MM-DD HH:MM:SS)",
440 "edited": "date(YYYY-MM-DD HH:MM:SS)",
441 "title": "photo title",
442 "desc": "photo description",
443 "album": "album name",
444 "filename": "original file name",
448 "profile": "1 if is profile photo",
450 "<scale>": "url to image",
454 "datasize": "size in byte",
455 "data": "base64 encoded image data"
464 <created>date(YYYY-MM-DD HH:MM:SS)</created>
465 <edited>date(YYYY-MM-DD HH:MM:SS)</edited>
466 <title>photo title</title>
467 <desc>photo description</desc>
468 <album>album name</album>
469 <filename>original file name</filename>
470 <type>mime type</type>
471 <height>number</height>
472 <width>number</width>
473 <profile>1 if is profile photo</profile>
475 <link type="mime type" scale="scale number" href="image url"/>
481 ### GET api/friendica/photos/list
483 Returns the API user's [Photo List Items](help/API-Entities#Photo+List+Item).
493 "album": "album name",
494 "filename": "original file name",
495 "type": "image mime type",
496 "thumb": "url to thumb sized image"
505 <photos type="array">
506 <photo id="resource_id"
508 filename="original file name"
509 type="image mime type">
510 "url to thumb sized image"
516 ### POST api/friendica/photo/create
518 Alias of [`api/friendica/photo/update`](#POST+api%2Ffriendica%2Fphoto%2Fupdate)
520 ### POST api/friendica/photo/update
522 Saves data for the scales 0-2 to database (see above for scale description).
523 Call adds non-public entries to items table to enable authenticated contacts to comment/like the photo.
524 Client should pay attention to the fact that updated access rights are not transferred to the contacts. i.e. public photos remain publicly visible if they have been commented/liked before setting visibility back to a limited group.
525 Currently it is best to inform user that updating rights is not the right way to do this, and offer a solution to add photo as a new photo with the new rights instead.
529 * `photo_id` (optional): if specified the photo with this id will be updated
530 * `media` (optional): image data as base64, only optional if photo_id is specified (new upload must have media)
531 * `desc` (optional): description for the photo, updated when photo_id is specified
532 * `album`: name of the album to be deleted (always necessary)
533 * `album_new` (optional): can be used to change the album of a single photo if photo_id is specified
534 * `allow_cid`/`allow_gid`/`deny_cid`/`deny_gid` (optional):
535 - on create: empty string or omitting = public photo, specify in format ```<x><y><z>``` for private photo
536 - on update: keys need to be present with empty values for changing a private photo to public
542 * new photo uploaded: JSON return with photo data (see [GET api/friendica/photo](#GET+api%2Ffriendica%2Fphoto))
543 * photo updated - changed photo data: JSON return with photo data (see [GET api/friendica/photo](#GET+api%2Ffriendica%2Fphoto))
544 * photo updated - changed info: JSON return `{"result": "updated", "message":"Image id 'xyz' has been updated."}`
545 * photo updated - nothing changed: JSON return `{"result": "cancelled","message": "Nothing to update for image id 'xyz'."}`
549 * 403 FORBIDDEN: if not authenticated
550 * 400 BADREQUEST: "no albumname specified", "no media data submitted", "photo not available", "acl data invalid"
551 * 500 INTERNALSERVERERROR: "image size exceeds PHP config settings, file was rejected by server",
552 "image size exceeds Friendica Config setting (uploaded size: x)",
553 "unable to process image data",
554 "image upload failed",
555 "unknown error - uploading photo failed, see Friendica log for more information",
556 "unknown error - update photo entry in database failed",
557 "unknown error - this error on uploading or updating a photo should never happen"
559 ### DELETE api/friendica/photo/delete
561 Deletes a single image with the specified id, is not reversible -> ensure that client is asking user for being sure to do this
562 Sets item table entries for this photo to deleted = 1.
566 * `photo_id`: id of the photo to be deleted
577 "message": "photo with id 'xyz' has been deleted from server."
583 * 403 FORBIDDEN: if not authenticated
584 * 400 BADREQUEST: "no photo_id specified", "photo not available"
585 * 500 INTERNALSERVERERROR: "unknown error on deleting photo", "problem with deleting items occurred"
589 ### POST/DELETE api/friendica/photoalbum/delete
591 Deletes all images with the specified album name, is not reversible -> ensure that client is asking user for being sure to do this.
595 * `album`: name of the album to be deleted
606 "message": "album 'xyz' with all containing photos has been deleted."
612 * 403 FORBIDDEN: if not authenticated
613 * 400 BADREQUEST: "no albumname specified", "album not available"
614 * 500 INTERNALSERVERERROR: "problem with deleting item occured", "unknown error - deleting from database failed"
616 ### POST/PUT api/friendica/photoalbum/update
618 Changes the album name to album_new for all photos in album.
622 * `album`: name of the album to be updated
623 * `album_new`: new name of the album
634 "message":"album 'abc' with all containing photos has been renamed to 'xyz'."
640 * 403 FORBIDDEN: if not authenticated
641 * 400 BADREQUEST: "no albumname specified", "no new albumname specified", "album not available"
642 * 500 INTERNALSERVERERROR: "unknown error - updating in database failed"
646 ### GET api/friendica/profile/show
648 Returns the [Profile](help/API-Entities#Profile) data of the authenticated user.
652 On success: Array of:
654 * `global_dir`: URL of the global directory set in server settings
655 * `friendica_owner`: user data of the authenticated user
656 * `profiles`: array of the profile data
659 HTTP 403 Forbidden: when no authentication was provided
660 HTTP 400 Bad Request: if given profile_id is not in the database or is not assigned to the authenticated user
662 General description of profile data in API returns:
663 - hide_friends: true if friends are hidden
666 - publish: true if published on the server's local directory
667 - net_publish: true if published to global_dir
679 - custom_fields: list of public custom fields
683 ### GET api/friendica/remoteauth
685 Similar as /redir, redirects to `url` after DFRN authentication.
689 - `c_url`: url of remote contact to auth to
690 - `url`: string, url to redirect after auth
692 ## Deprecated endpoints
694 - POST api/statuses/mediap