From 481d6455cb94e35725c0ea6906a03c252722bc2a Mon Sep 17 00:00:00 2001 From: Dale Price Date: Wed, 5 Feb 2025 03:23:52 -0600 Subject: [PATCH] Add privacy policy and terms of service endpoints (#1594) * Add privacy policy and terms of service endpoints * Shorten the example privacy policy response --- content/en/entities/PrivacyPolicy.md | 44 ++++++++++++++++++++ content/en/methods/instance.md | 61 ++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 content/en/entities/PrivacyPolicy.md diff --git a/content/en/entities/PrivacyPolicy.md b/content/en/entities/PrivacyPolicy.md new file mode 100644 index 00000000..176bba91 --- /dev/null +++ b/content/en/entities/PrivacyPolicy.md @@ -0,0 +1,44 @@ +--- +title: PrivacyPolicy +description: Represents the privacy policy of the instance. +menu: + docs: + parent: entities +aliases: [ + "/entities/privacypolicy", + "/entities/PrivacyPolicy", + "/api/entities/privacypolicy", + "/api/entities/PrivacyPolicy", +] +--- + +## Example + +```json +{ + "updated_at": "2022-10-07T00:00:00+00:00", + "content": "

This privacy policy describes how example.com ("example.com", "we", "us") collects,\nprotects and uses the personally identifiable information you may provide\nthrough the example.com website or its API.

\n\n

What information do we collect?

\n\n\n\n
\n\n

This document is CC-BY-SA. Originally adapted from the Discourse privacy\npolicy.

\n" +} +``` + +## Attributes + +### `updated_at` {#updated_at} + +**Description:** A timestamp of when the privacy policy was last updated.\ +**Type:** String ([Datetime](/api/datetime-format#datetime))\ +**Version history:**\ +4.0.0 - added + +### `content` {#content} + +**Description:** The rendered HTML content of the privacy policy.\ +**Type:** String (HTML)\ +**Version history:**\ +4.0.0 - added + +## See also + +{{< page-relref ref="methods/instance#privacy_policy" caption="GET /api/v1/instance/privacy_policy" >}} + +{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/serializers/rest/privacy_policy_serializer.rb" caption="app/serializers/rest/privacy_policy_serializer.rb" >}} \ No newline at end of file diff --git a/content/en/methods/instance.md b/content/en/methods/instance.md index 1e2339fd..c144af95 100644 --- a/content/en/methods/instance.md +++ b/content/en/methods/instance.md @@ -515,6 +515,63 @@ Obtain an extended description of this server --- +## View privacy policy {#privacy_policy} + +```http +GET /api/v1/instance/privacy_policy HTTP/1.1 +``` + +Obtain the contents of this server's privacy policy. + +**Returns:** [PrivacyPolicy]({{< relref "entities/PrivacyPolicy" >}})\ +**OAuth:** Public\ +**Version history:**\ +4.0.0 - added + +#### Response + +##### 200: OK + +```json +{ + "updated_at": "2022-10-07T00:00:00+00:00", + "content": "

This privacy policy describes how example.com ("example.com", "we", "us") collects,\nprotects and uses the personally identifiable information you may provide\nthrough the example.com website or its API.

\n\n

What information do we collect?

\n\n\n\n
\n\n

This document is CC-BY-SA. Originally adapted from the Discourse privacy\npolicy.

\n" +} +``` + +--- + +## View terms of service {#terms_of_service} + +```http +GET /api/v1/instance/terms_of_service HTTP/1.1 +``` + +Obtain the contents of this server's terms of service, if configured. + +**Returns:** [PrivacyPolicy]({{< relref "entities/PrivacyPolicy" >}})\ +**OAuth:** Public\ +**Version history:**\ +4.4.0 - added + +#### Response + +##### 200: OK + + + +##### 404: Not Found + +No terms of service have been configured for this instance. + +```json +{ + "error": "Record not found" +} +``` + +--- + ## View translation languages {#translation_languages} ```http @@ -707,3 +764,7 @@ Obtain general information about the server. See [api/v2/instance]({{< relref "m {{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/instances/peers_controller.rb" caption="app/controllers/api/v1/instances/peers_controller.rb" >}} {{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/instances/rules_controller.rb" caption="app/controllers/api/v1/instances/rules_controller.rb" >}} + +{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/instances/privacy_policies_controller.rb" caption="app/controllers/api/v1/instances/privacy_policies_controller.rb" >}} + +{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/instances/terms_of_services_controller.rb" caption="app/controllers/api/v1/instances/terms_of_services_controller.rb" >}}