Skip to main content

Core Types

ActivityStreams 2.0 defines a small set of core types that form the foundation for all ActivityPub objects. Every object in ActivityStreams inherits from these base types.

Type Hierarchy

ACTIVITYSTREAMS TYPE HIERARCHYObject(base type)Activity├ IntransitiveActivity└ (All activity types)ActorPerson, Group,Application, Service,OrganizationCollectionOrderedCollection,CollectionPage, ...└ (Note, Article, Image, Video...)Link(separate)MentionLegend:Base typeSubtype

Object

The base type for all ActivityStreams objects.

Definition

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Object",
"id": "https://example.com/objects/1",
"name": "A Simple Object"
}

Common Properties

PropertyTypeDescription
@contextString/ArrayJSON-LD context
typeString/ArrayThe object type(s)
idString (URI)Globally unique identifier
nameStringHuman-readable name
contentStringText content (often HTML)
summaryStringBrief description
publishedDateTimeWhen created
updatedDateTimeWhen last modified
attributedToObject/LinkCreator/author
toArrayPrimary recipients
ccArraySecondary recipients
btoArrayBlind primary recipients
bccArrayBlind secondary recipients

Example

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Object",
"id": "https://example.com/objects/unique-id",
"name": "My Object",
"content": "This is the content of the object",
"published": "2024-01-15T10:00:00Z",
"updated": "2024-01-15T12:00:00Z",
"attributedTo": "https://example.com/users/alice"
}

Represents a reference to another resource. Links are not Objects—they're a separate base type.

Definition

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Link",
"href": "https://example.com/resource",
"mediaType": "text/html"
}
PropertyTypeDescription
hrefString (URI)The target resource URL
relString/ArrayLink relation type
mediaTypeStringMIME type of the target
nameStringHuman-readable name
hreflangStringLanguage of the target
heightIntegerHeight in pixels
widthIntegerWidth in pixels
previewObject/LinkPreview of the linked resource

Example

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Link",
"href": "https://example.com/article",
"mediaType": "text/html",
"name": "An Interesting Article",
"hreflang": "en"
}

Activity

Represents an action. Activities are the primary way to describe what's happening in ActivityPub.

Definition

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Activity",
"actor": "https://example.com/users/alice",
"object": "https://example.com/notes/1"
}

Activity Properties

PropertyTypeDescription
actorObject/LinkWho performed the activity
objectObject/LinkWhat the activity is about
targetObject/LinkIndirect object (e.g., Add to target)
resultObject/LinkResult of the activity
originObject/LinkWhere the activity originated
instrumentObject/LinkTool used to perform the activity

Example

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Create",
"id": "https://example.com/activities/1",
"actor": "https://example.com/users/alice",
"object": {
"type": "Note",
"content": "Hello, world!"
},
"published": "2024-01-15T10:00:00Z"
}

IntransitiveActivity

An Activity without an object property. The action is self-contained.

Examples

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Arrive",
"actor": "https://example.com/users/alice",
"location": {
"type": "Place",
"name": "San Francisco"
}
}
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Travel",
"actor": "https://example.com/users/alice",
"origin": {
"type": "Place",
"name": "New York"
},
"target": {
"type": "Place",
"name": "Los Angeles"
}
}

Collection

Represents an ordered or unordered set of Objects or Links.

Definition

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Collection",
"totalItems": 3,
"items": [
"https://example.com/objects/1",
"https://example.com/objects/2",
"https://example.com/objects/3"
]
}

Collection Properties

PropertyTypeDescription
totalItemsIntegerTotal number of items
itemsArrayThe items (unordered)
currentCollectionPage/LinkCurrent page
firstCollectionPage/LinkFirst page
lastCollectionPage/LinkLast page

Example

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Collection",
"id": "https://example.com/users/alice/followers",
"totalItems": 150,
"first": "https://example.com/users/alice/followers?page=1"
}

OrderedCollection

A Collection where the order of items is significant.

Definition

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "OrderedCollection",
"totalItems": 3,
"orderedItems": [
"https://example.com/objects/3",
"https://example.com/objects/2",
"https://example.com/objects/1"
]
}

Used For

  • Outbox (newest first)
  • Inbox (newest first)
  • Followers lists
  • Following lists
  • Liked posts

Example

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "OrderedCollection",
"id": "https://example.com/users/alice/outbox",
"totalItems": 1250,
"first": "https://example.com/users/alice/outbox?page=true",
"last": "https://example.com/users/alice/outbox?min_id=0&page=true"
}

CollectionPage

A single page of a Collection.

Definition

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "CollectionPage",
"partOf": "https://example.com/collection",
"items": [...]
}

CollectionPage Properties

PropertyTypeDescription
partOfCollection/LinkThe parent collection
nextCollectionPage/LinkNext page
prevCollectionPage/LinkPrevious page

Example

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "CollectionPage",
"id": "https://example.com/users/alice/followers?page=1",
"partOf": "https://example.com/users/alice/followers",
"next": "https://example.com/users/alice/followers?page=2",
"items": [
"https://example.com/users/bob",
"https://example.com/users/carol"
]
}

OrderedCollectionPage

A single page of an OrderedCollection.

Definition

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "OrderedCollectionPage",
"partOf": "https://example.com/collection",
"orderedItems": [...],
"startIndex": 0
}

Additional Property

PropertyTypeDescription
startIndexIntegerIndex of the first item

Example

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "OrderedCollectionPage",
"id": "https://example.com/users/alice/outbox?page=true",
"partOf": "https://example.com/users/alice/outbox",
"next": "https://example.com/users/alice/outbox?max_id=123&page=true",
"prev": "https://example.com/users/alice/outbox?min_id=456&page=true",
"orderedItems": [
{
"type": "Create",
"object": { "type": "Note", "content": "Hello!" }
}
]
}

Type Coercion

Objects can have multiple types:

{
"@context": "https://www.w3.org/ns/activitystreams",
"type": ["Person", "Object"],
"id": "https://example.com/users/alice",
"name": "Alice"
}

Null Values

Properties with null values should be omitted rather than included:

// Correct
{
"type": "Note",
"content": "Hello"
}

// Avoid
{
"type": "Note",
"content": "Hello",
"summary": null
}

Next Steps