Skip to content

Commit

Permalink
Add privacy policy and terms of service endpoints (#1594)
Browse files Browse the repository at this point in the history
* Add privacy policy and terms of service endpoints

* Shorten the example privacy policy response
  • Loading branch information
daprice authored Feb 5, 2025
1 parent 5f9cf32 commit 481d645
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
44 changes: 44 additions & 0 deletions content/en/entities/PrivacyPolicy.md
Original file line number Diff line number Diff line change
@@ -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": "<p>This privacy policy describes how example.com (&quot;example.com&quot;, &quot;we&quot;, &quot;us&quot;) collects,\nprotects and uses the personally identifiable information you may provide\nthrough the example.com website or its API.</p>\n\n<h1>What information do we collect?</h1>\n\n<ul>\n<li><strong>Basic account information</strong>: If you register on this server, you may be\nasked to enter a username, an e-mail address and a password.</li>\n<li><strong>Posts, following and other public information</strong>: The list of people you\nfollow is listed publicly, the same is true for your followers.</li>\n<li><strong>Direct and followers-only posts</strong>: All posts are stored and processed on the\nserver. You may\ntoggle an option to approve and reject new followers manually in the settings.\n<strong>Please keep in mind that the operators of the server and any receiving\nserver may view such messages</strong>, and that recipients may screenshot, copy or\notherwise re-share them. <strong>Do not share any sensitive information over\nMastodon.</strong></li>\n<li><strong>IPs and other metadata</strong>: When you log in, we record the IP address you log\nin from, as well as the name of your browser application.</li>\n</ul>\n\n<hr>\n\n<p>This document is CC-BY-SA. Originally adapted from the <a href=\"https://github.com/discourse/discourse\">Discourse privacy\npolicy</a>.</p>\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" >}}
61 changes: 61 additions & 0 deletions content/en/methods/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": "<p>This privacy policy describes how example.com (&quot;example.com&quot;, &quot;we&quot;, &quot;us&quot;) collects,\nprotects and uses the personally identifiable information you may provide\nthrough the example.com website or its API.</p>\n\n<h1>What information do we collect?</h1>\n\n<ul>\n<li><strong>Basic account information</strong>: If you register on this server, you may be\nasked to enter a username, an e-mail address and a password.</li>\n<li><strong>Posts, following and other public information</strong>: The list of people you\nfollow is listed publicly, the same is true for your followers.</li>\n<li><strong>Direct and followers-only posts</strong>: All posts are stored and processed on the\nserver. You may\ntoggle an option to approve and reject new followers manually in the settings.\n<strong>Please keep in mind that the operators of the server and any receiving\nserver may view such messages</strong>, and that recipients may screenshot, copy or\notherwise re-share them. <strong>Do not share any sensitive information over\nMastodon.</strong></li>\n<li><strong>IPs and other metadata</strong>: When you log in, we record the IP address you log\nin from, as well as the name of your browser application.</li>\n</ul>\n\n<hr>\n\n<p>This document is CC-BY-SA. Originally adapted from the <a href=\"https://github.com/discourse/discourse\">Discourse privacy\npolicy</a>.</p>\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
Expand Down Expand Up @@ -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" >}}

0 comments on commit 481d645

Please sign in to comment.