4

I know that servers communicate by POSTing to an inbox and outbox. But what's the URL for the inbox and outbox?

Evan Conrad
  • 3,993
  • 4
  • 28
  • 46

1 Answers1

9

How to get the inbox or outbox URL

The URL is whatever the implementing server says it is. So it's different for each ActivityPub server.

The inbox and outbox URL for an actor is defined in the JSON-LD document for an actor:

{ 
  "@context": ["https://www.w3.org/ns/activitystreams",
               {"@language": "ja"}],
  "type": "Person",
  "id": "https://kenzoishii.example.com/",
  
  // Right here!
  "inbox": "https://kenzoishii.example.com/inbox.json",
  "outbox": "https://kenzoishii.example.com/feed.json",

  ...
}

This also means that the inbox and outbox can be actor-specific, not just server specific.

How to get the actor JSON

Some ActivityPub sites like Mastodon make use of Webfinger to standardize a URL that can be used to get an actor's JSON-LD doc:

/.well-known/webfinger?resource=acct:foo@example.org

In this case, if you wanted to know the inbox for flaque@mastodon.social, you would first query the webfinger:

GET https://mastodon.technology/.well-known/webfinger?resource=acct:flaque@mastodon.technology

That would give you a JSON object like this:

{
  subject: "acct:Flaque@mastodon.technology",
  links: [
    {
      rel: "self",
      type: "application/activity+json",
      href: "https://mastodon.technology/users/Flaque"
    }
  ]
}

With that href: https://mastodon.technology/users/Flaque, you can get the JSON representation with:

https://mastodon.technology/users/Flaque.json

(Note the .json!)

That would then give you a full actor object, which would include the inbox and outbox:

{
  "inbox": "https://mastodon.technology/users/Flaque/inbox",
  "outbox": "https://mastodon.technology/users/Flaque/outbox",
  ...
} 
Community
  • 1
  • 1
Evan Conrad
  • 3,993
  • 4
  • 28
  • 46
  • To get the inbox/outbox queue for an actor you must sen a GET request with an Accept header value of "application/ld+json; profile="https://www.w3.org/ns/activitystreams". It's better (because in the ActivityPub spec) than adding the .json extension to the URL. – Patrick PREMARTIN Nov 20 '22 at 15:56
  • I 100% agree that calling the URL as given in the webfinger response should be the correct way to get the actor json, but for my user it doesn't work. Only adding .json (hate doing this) seems to work: [curl -H 'Accept: application/ld+json; profile="https://w3.org/ns/activitystreams"' https://mastodon.social/users/haentz] does not show the json data… – Haentz Jul 05 '23 at 08:18