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/friendica/events
20 Returns a list of [Event](help/API-Entities#Event) entities for the current logged in user.
24 - `since_id`: (optional) minimum event id for pagination
25 - `count`: maximum number of items returned, default 20
27 ### GET api/externalprofile/show
29 Returns a [Contact](help/API-Entities#Contact) entity for the provided profile URL.
33 - `profileurl`: Profile URL
35 ### GET api/statuses/public_timeline
37 Returns a list of public [Items](help/API-Entities#Item) posted on this node.
38 Equivalent of the local community page.
42 * `count`: Items per page (default: 20)
44 * `since_id`: minimum id
45 * `max_id`: maximum id
46 * `exclude_replies`: don't show replies (default: false)
47 * `conversation_id`: Shows all statuses of a given conversation.
48 * `include_entities`: "true" shows entities for pictures and links (Default: false)
50 #### Unsupported parameters
54 ### GET api/statuses/networkpublic_timeline
56 Returns a list of public [Items](help/API-Entities#Item) this node is aware of.
57 Equivalent of the global community page.
61 * `count`: Items per page (default: 20)
63 * `since_id`: minimum id
64 * `max_id`: maximum id
65 * `exclude_replies`: don't show replies (default: false)
66 * `conversation_id`: Shows all statuses of a given conversation.
67 * `include_entities`: "true" shows entities for pictures and links (Default: false)
69 ### GET api/statuses/replies
73 * `count`: Items per page (default: 20)
75 * `since_id`: minimum id
76 * `max_id`: maximum id
77 * `include_entities`: "true" shows entities for pictures and links (Default: false)
79 #### Unsupported parameters
83 * `contributor_details`
87 ### GET api/conversation/show
89 Unofficial Twitter command. It shows all direct answers (excluding the original post) to a given id.
93 * `id`: id of the post
94 * `count`: Items per page (default: 20)
96 * `since_id`: minimum id
97 * `max_id`: maximum id
98 * `include_entities`: "true" shows entities for pictures and links (Default: false)
100 #### Unsupported parameters
104 * `contributor_details`
106 ### GET api/statusnet/conversation
108 Alias of [`api/conversation/show`](#GET+api%2Fconversation%2Fshow).
110 ### GET api/statusnet/config
112 Returns the public Friendica node configuration.
114 ### GET api/gnusocial/config
116 Alias of [`api/statusnet/config`](#GET+api%2Fstatusnet%2Fconfig).
118 ### GET api/statusnet/version
120 Returns a fake static StatusNet protocol version.
122 ### GET api/gnusocial/version
124 Alias of [`api/statusnet/version`](#GET+api%2Fstatusnet%2Fversion).
128 ### POST api/friendica/activity/[verb]
130 Add or remove an activity from an item.
131 'verb' can be one of:
139 To remove an activity, prepend the verb with "un", eg. "unlike" or "undislike"
140 Attend verbs disable eachother: that means that if "attendyes" was added to an item, adding "attendno" remove previous "attendyes".
141 Attend verbs should be used only with event-related items (there is no check at the moment).
163 ### GET api/direct_messages
165 Deprecated Twitter received direct message list endpoint.
169 * `count`: Items per page (default: 20)
170 * `page`: page number
171 * `since_id`: minimum id
172 * `max_id`: maximum id
173 * `getText`: Defines the format of the status field. Can be "html" or "plain"
174 * `include_entities`: "true" shows entities for pictures and links (Default: false)
175 * `friendica_verbose`: "true" enables different error returns (default: "false")
177 #### Unsupported parameters
181 ### GET api/direct_messages/all
183 Returns all [Private Messages](help/API-Entities#Private+message).
187 * `count`: Items per page (default: 20)
188 * `page`: page number
189 * `since_id`: minimum id
190 * `max_id`: maximum id
191 * `getText`: Defines the format of the status field. Can be "html" or "plain"
192 * `friendica_verbose`: "true" enables different error returns (default: "false")
194 ### GET api/direct_messages/conversation
196 Returns all replies of a single private message conversation. Returns [Private Messages](help/API-Entities#Private+message)
200 * `count`: Items per page (default: 20)
201 * `page`: page number
202 * `since_id`: minimum id
203 * `max_id`: maximum id
204 * `getText`: Defines the format of the status field. Can be "html" or "plain"
205 * `uri`: URI of the conversation
206 * `friendica_verbose`: "true" enables different error returns (default: "false")
208 ### GET api/direct_messages/sent
210 Deprecated Twitter sent direct message list endpoint. Returns [Private Messages](help/API-Entities#Private+message).
214 * `count`: Items per page (default: 20)
215 * `page`: page number
216 * `since_id`: minimum id
217 * `max_id`: maximum id
218 * `getText`: Defines the format of the status field. Can be "html" or "plain"
219 * `include_entities`: "true" shows entities for pictures and links (Default: false)
220 * `friendica_verbose`: "true" enables different error returns (default: "false")
223 ### POST/PUT api/direct_messages/new
225 Deprecated Twitter direct message submission endpoint.
229 * `user_id`: id of the user
230 * `screen_name`: screen name (for technical reasons, this value is not unique!)
231 * `text`: The message
232 * `replyto`: ID of the replied direct message
233 * `title`: Title of the direct message
235 ### POST/DELETE api/direct_messages/destroy
237 Deprecated Twitter direct message deletion endpoint.
241 * `id`: id of the message to be deleted
242 * `include_entities`: optional, currently not yet implemented
243 * `friendica_parenturi`: optional, can be used for increased safety to delete only intended messages
244 * `friendica_verbose`: "true" enables different error returns (default: "false")
250 * JSON return as defined for Twitter API not yet implemented
251 * on friendica_verbose=true: JSON return {"result":"ok","message":"message deleted"}
256 * on friendica_verbose=true: different JSON returns {"result":"error","message":"xyz"}
258 ### GET api/friendica/direct_messages_setseen
262 * `id`: id of the message to be updated as seen
268 * JSON return `{"result": "ok", "message": "message set to seen"}`
272 * different JSON returns `{"result": "error", "message": "xyz"}`
275 ### GET api/friendica/direct_messages_search (GET; AUTH)
277 Returns [Private Messages](help/API-Entities#Private+message) matching the provided search string.
281 * `searchstring`: string for which the API call should search as '%searchstring%' in field 'body' of all messages of the authenticated user (caption ignored)
282 * `getText` (optional): `plain`|`html` If ommited, the title is prepended to the plaintext body in the `text` attribute of the private message objects.
283 * `getUserObjects` (optional): `true`|`false` If `false`, the `sender` and `recipient` attributes of the private message object are absent.
287 Returns only tested with JSON, XML might work as well.
291 * JSON return `{"success":"true", "search_results": array of found messages}`
292 * JSOn return `{"success":"false", "search_results": "nothing found"}`
296 * different JSON returns `{"result": "error", "message": "searchstring not specified"}`
300 ### GET api/friendica/group_show
302 Return all or a specified group of the user with the containing contacts as array.
306 * `gid`: optional, if not given, API returns all groups of the user
312 * `name`: name of the group
313 * `gid`: id of the group
314 * `user`: array of [Contacts](help/API-Entities#Contact)
316 ### POST/PUT api/friendica/group_create
318 Create the group with the posted array of contacts as members.
322 * `name`: name of the group to be created
326 JSON data as Array like the result of [GET api/friendica/group_show](#GET+api%2Ffriendica%2Fgroup_show):
330 * List of [Contacts](help/API-Entities#Contact)
336 * `success`: true if successfully created or reactivated
337 * `gid`: gid of the created group
338 * `name`: name of the created group
339 * `status`: "missing user" | "reactivated" | "ok"
340 * `wrong users`: array of users, which were not available in the contact table
342 ### POST api/friendica/group_update
344 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).
348 * `gid`: id of the group to be changed
349 * `name`: name of the group to be changed
353 JSON data as array like the result of [GET api/friendica/group_show](#GET+api%2Ffriendica%2Fgroup_show):
357 * List of [Contacts](help/API-Entities#Contact)
363 * `success`: true if successfully updated
364 * `gid`: gid of the changed group
365 * `name`: name of the changed group
366 * `status`: "missing user" | "ok"
367 * `wrong users`: array of users, which were not available in the contact table
369 ### POST/DELETE api/friendica/group_delete
371 Delete the specified group of contacts; API call need to include the correct gid AND name of the group to be deleted.
375 * `gid`: id of the group to be deleted
376 * `name`: name of the group to be deleted
382 * `success`: true if successfully deleted
383 * `gid`: gid of the deleted group
384 * `name`: name of the deleted group
385 * `status`: "deleted" if successfully deleted
386 * `wrong users`: empty array
390 ### GET api/friendica/notifications
392 Return last 50 [Notifications](help/API-Entities#Notification) for the current user, ordered by date with unseen item on top.
398 ### POST api/friendica/notifications/seen
400 Set notification as seen.
404 - `id`: id of the notification to set seen
408 If the note is linked to an item, returns an [Item](help/API-Entities#Item).
410 Otherwise, a success status is returned:
412 * `success` (json) | `<status>success</status>` (xml)
416 ### GET api/friendica/photo
418 Returns a [Photo](help/API-Entities#Photo).
422 * `photo_id`: Resource id of a photo.
423 * `scale`: (optional) scale value of the photo
425 Returns data of a picture with the given resource.
426 If 'scale' isn't provided, returned data include full url to each scale of the photo.
427 If 'scale' is set, returned data include image data base64 encoded.
429 possibile scale value are:
431 * 0: original or max size by server settings
432 * 1: image with or height at <= 640
433 * 2: image with or height at <= 320
434 * 3: thumbnail 160x160
435 * 4: Profile image at 300x300
436 * 5: Profile image at 80x80
437 * 6: Profile image at 48x48
439 An image used as profile image has only scale 4-6, other images only 0-3
448 "created": "date(YYYY-MM-DD HH:MM:SS)",
449 "edited": "date(YYYY-MM-DD HH:MM:SS)",
450 "title": "photo title",
451 "desc": "photo description",
452 "album": "album name",
453 "filename": "original file name",
457 "profile": "1 if is profile photo",
459 "<scale>": "url to image",
463 "datasize": "size in byte",
464 "data": "base64 encoded image data"
473 <created>date(YYYY-MM-DD HH:MM:SS)</created>
474 <edited>date(YYYY-MM-DD HH:MM:SS)</edited>
475 <title>photo title</title>
476 <desc>photo description</desc>
477 <album>album name</album>
478 <filename>original file name</filename>
479 <type>mime type</type>
480 <height>number</height>
481 <width>number</width>
482 <profile>1 if is profile photo</profile>
484 <link type="mime type" scale="scale number" href="image url"/>
490 ### GET api/friendica/photos/list
492 Returns the API user's [Photo List Items](help/API-Entities#Photo+List+Item).
502 "album": "album name",
503 "filename": "original file name",
504 "type": "image mime type",
505 "thumb": "url to thumb sized image"
514 <photos type="array">
515 <photo id="resource_id"
517 filename="original file name"
518 type="image mime type">
519 "url to thumb sized image"
525 ### POST api/friendica/photo/create
527 Alias of [`api/friendica/photo/update`](#POST+api%2Ffriendica%2Fphoto%2Fupdate)
529 ### POST api/friendica/photo/update
531 Saves data for the scales 0-2 to database (see above for scale description).
532 Call adds non-public entries to items table to enable authenticated contacts to comment/like the photo.
533 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.
534 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.
538 * `photo_id` (optional): if specified the photo with this id will be updated
539 * `media` (optional): image data as base64, only optional if photo_id is specified (new upload must have media)
540 * `desc` (optional): description for the photo, updated when photo_id is specified
541 * `album`: name of the album to be deleted (always necessary)
542 * `album_new` (optional): can be used to change the album of a single photo if photo_id is specified
543 * `allow_cid`/`allow_gid`/`deny_cid`/`deny_gid` (optional):
544 - on create: empty string or omitting = public photo, specify in format ```<x><y><z>``` for private photo
545 - on update: keys need to be present with empty values for changing a private photo to public
551 * new photo uploaded: JSON return with photo data (see [GET api/friendica/photo](#GET+api%2Ffriendica%2Fphoto))
552 * photo updated - changed photo data: JSON return with photo data (see [GET api/friendica/photo](#GET+api%2Ffriendica%2Fphoto))
553 * photo updated - changed info: JSON return `{"result": "updated", "message":"Image id 'xyz' has been updated."}`
554 * photo updated - nothing changed: JSON return `{"result": "cancelled","message": "Nothing to update for image id 'xyz'."}`
558 * 403 FORBIDDEN: if not authenticated
559 * 400 BADREQUEST: "no albumname specified", "no media data submitted", "photo not available", "acl data invalid"
560 * 500 INTERNALSERVERERROR: "image size exceeds PHP config settings, file was rejected by server",
561 "image size exceeds Friendica Config setting (uploaded size: x)",
562 "unable to process image data",
563 "image upload failed",
564 "unknown error - uploading photo failed, see Friendica log for more information",
565 "unknown error - update photo entry in database failed",
566 "unknown error - this error on uploading or updating a photo should never happen"
568 ### DELETE api/friendica/photo/delete
570 Deletes a single image with the specified id, is not reversible -> ensure that client is asking user for being sure to do this
571 Sets item table entries for this photo to deleted = 1.
575 * `photo_id`: id of the photo to be deleted
586 "message": "photo with id 'xyz' has been deleted from server."
592 * 403 FORBIDDEN: if not authenticated
593 * 400 BADREQUEST: "no photo_id specified", "photo not available"
594 * 500 INTERNALSERVERERROR: "unknown error on deleting photo", "problem with deleting items occurred"
598 ### POST/DELETE api/friendica/photoalbum/delete
600 Deletes all images with the specified album name, is not reversible -> ensure that client is asking user for being sure to do this.
604 * `album`: name of the album to be deleted
615 "message": "album 'xyz' with all containing photos has been deleted."
621 * 403 FORBIDDEN: if not authenticated
622 * 400 BADREQUEST: "no albumname specified", "album not available"
623 * 500 INTERNALSERVERERROR: "problem with deleting item occured", "unknown error - deleting from database failed"
625 ### POST/PUT api/friendica/photoalbum/update
627 Changes the album name to album_new for all photos in album.
631 * `album`: name of the album to be updated
632 * `album_new`: new name of the album
643 "message":"album 'abc' with all containing photos has been renamed to 'xyz'."
649 * 403 FORBIDDEN: if not authenticated
650 * 400 BADREQUEST: "no albumname specified", "no new albumname specified", "album not available"
651 * 500 INTERNALSERVERERROR: "unknown error - updating in database failed"
655 ### GET api/friendica/profile/show
657 Returns the [Profile](help/API-Entities#Profile) data of the authenticated user.
661 On success: Array of:
663 * `global_dir`: URL of the global directory set in server settings
664 * `friendica_owner`: user data of the authenticated user
665 * `profiles`: array of the profile data
668 HTTP 403 Forbidden: when no authentication was provided
669 HTTP 400 Bad Request: if given profile_id is not in the database or is not assigned to the authenticated user
671 General description of profile data in API returns:
672 - hide_friends: true if friends are hidden
675 - publish: true if published on the server's local directory
676 - net_publish: true if published to global_dir
688 - custom_fields: list of public custom fields
692 ## Deprecated endpoints
694 - POST api/statuses/mediap