---
title: "ActivityPub (activity.json)"
description: "Federated identity for social AI."
canonical: "https://geordy.ai/formats/activitypub"
---
# ActivityPub

**Federated identity for social AI.**

Decentralized protocol for publishing activities and identity. Reaches the federated AI ecosystem (Mastodon and beyond).

ActivityPub is a decentralized social networking protocol enabling users of any compliant service to communicate with users on any other compliant service, regardless of implementation. Created by the W3C Social Web Working Group and first released in 2018.

## At a glance

- File: `activity.json`
- First released: 2018
- Created by: W3C Social Web Working Group
- Specification: https://www.w3.org/TR/activitypub/
- Read by: Federated AI, Mastodon agents, Fediverse crawlers

## Why it matters for AI

ActivityPub is the W3C standard server-to-server and client-to-server protocol that powers the Fediverse (Mastodon, Pixelfed, PeerTube, Lemmy, Threads federation), letting AI agents and crawlers consume and publish social content as portable, JSON-LD-typed Activity Streams. Because every actor and object has a stable URI and a machine-typed JSON-LD context, content is structured for retrieval and attribution rather than scraped HTML.

## Example

```
{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Create",
  "actor": {
    "type": "Person",
    "id": "https://mastodon.social/@alice",
    "name": "Alice"
  },
  "object": {
    "type": "Note",
    "content": "<p>Hello, Fediverse!</p>"
  }
}
```

## Benefits

- Open, decentralized protocol
- Interoperability across Fediverse platforms
- JSON-LD is parseable by AI systems

## Best practices

- Always include the JSON-LD @context (`https://www.w3.org/ns/activitystreams` plus `security/v1` when signing) and serve Activity objects with `Content-Type: application/activity+json`.
- Use HTTP Signatures on all server-to-server POSTs to inboxes; verify signatures and the actor's publicKeyPem on receipt.
- Implement idempotent inbox handling (deduplicate by activity id) and respect Accept/Reject for follow requests rather than auto-accepting.
- Expose actor metadata via WebFinger (`.well-known/webfinger`) so user@host lookups resolve to the actor IRI.

## Pitfalls

- Treating delivery as synchronous - inboxes must be processed asynchronously and retried with backoff to handle slow/offline peers.
- Sending un-signed activities or accepting un-signed activities, which breaks federation with Mastodon and exposes spoofing risks.
- Confusing the Object id (a dereferenceable URI) with a database primary key; ids must be HTTPS URLs that resolve to the canonical JSON-LD representation.

## Use cases

- **Decentralized social networks**
- **Content federation**
- **Social analytics**

## Adopters

- Mastodon (https://joinmastodon.org/)
- Pixelfed (https://pixelfed.org/)
- PeerTube (https://joinpeertube.org/)
- Lemmy (https://join-lemmy.org/)
- Threads (Meta) (https://www.threads.net/)
---

Source: https://geordy.ai/formats/activitypub
This is a machine-readable markdown version of that page, generated by Geordy.