Skip to main content

WebFinger Endpoint

WebFinger (RFC 7033) discovers actor profiles from handles.

Endpoint

GET /.well-known/webfinger?resource=acct:{user}@{domain}

Request

GET /.well-known/webfinger?resource=acct:alice@example.com
Accept: application/jrd+json

Response

{
"subject": "acct:alice@example.com",
"links": [
{
"rel": "self",
"type": "application/activity+json",
"href": "https://example.com/users/alice"
}
]
}

Required Fields

FieldDescription
subjectRequested resource
links[].relself for ActivityPub
links[].typeapplication/activity+json
links[].hrefActor URL

Implementation

app.get('/.well-known/webfinger', (req, res) => {
const resource = req.query.resource;
const [, user, domain] = resource.match(/acct:(.+)@(.+)/);

res.type('application/jrd+json').json({
subject: resource,
links: [{
rel: 'self',
type: 'application/activity+json',
href: `https://${domain}/users/${user}`
}]
});
});

CORS

Allow cross-origin requests:

res.header('Access-Control-Allow-Origin', '*');

See Also