Mangrove Server API (0.6.0)

Download OpenAPI specification:

Open Reviews Association: hello@open-reviews.net License: Apache-2.0

Submit and retrieve reviews, as well as aggregate statistics about reviews.

Documentation & Resources

Common

index

Responses

Review

Retrieve aggregates for multiple subjects or issuers.

Request Body schema: application/json
required
pems
required
Array of strings or null

List of issuer public keys to get information about.

Query allowing for retrieval of information about multiple subjects or issuers.

subs
required
Array of strings or null <uri> [ items <uri > ]

A map from Review identifiers (urn:maresi:<signature>) to information about the reviews of that review.

List of subject URIs to get information about.

Responses

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
{
  • "issuers": {
    },
  • "subjects": {
    }
}

Request the accepted equivalence classes of subjects.

The aggregator accepts a claimed pair of subjects once the credibility-weighted support of the claim and its ratings reaches the threshold. It writes each member of a class with the URI that names the class, and members with one canonical_sub are one subject.

Without sub, the route returns every row in pages ordered by sub. The next page starts after the last sub of the previous one, and a page shorter than limit is the last. The JSON dump holds every row as well.

query Parameters
sub
string <uri>
Example: sub=https://nytimes.com

The members of the classes this subject belongs to. A geo: URI belongs to every class with a geo: member at the same place: within the sum of the two u values and under an agreeing q name. Without it, the route pages through every row. The list is empty for a subject outside every class.

after
string

Rows whose sub sorts after this URI in the order of the pages. Pass the last sub of the previous page to get the next one. sub overrides it.

limit
integer <int64> [ 1 .. 1000 ]

Most rows to return, from 1 to 1000, 1000 by default. sub overrides it.

Responses

Response samples

Content type
application/json
{}

Request reviews within provided coordinates.

/reviews?bbox=xmin,ymin,xmax,ymax returns the same reviews and accepts every other filter of /reviews, along with limit and offset. The box spans xmin to xmax in longitude and ymin to ymax in latitude, and -180, -90, 180, 90 covers the whole world. The response holds at most the 1000 most recently signed reviews of places inside the box, or 500 as N-Triples, each in its latest version. The other filters are the defaults of /reviews, so claims stay out, and so do reviews of test subjects unless examples is true.

query Parameters
xmin
required
number <float>

Minimum longitude

ymin
required
number <float>

Minimum latitude

xmax
required
number <float>

Maximum longitude

ymax
required
number <float>

Maximum latitude

examples
boolean

Include reviews of test subjects, as SubjectUri::is_test_uri names them.

Responses

Response samples

Content type
{
  • "issuers": {
    },
  • "maresi_subjects": {
    },
  • "reviews": [
    ]
}

Request aggregate information about the reviewer.

path Parameters
pem
required
string
Example: -----BEGIN PUBLIC KEY-----MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEDo6mN4kY6YFhpvF0u3hfVWD1RnDElPweX3U3KiUAx0dVeFLPAmeKdQY3J5agY3VspnHo1p/wH9hbZ63qPbCr6g==-----END PUBLIC KEY-----

Request aggregate information about the reviewer.

Responses

Response samples

Content type
application/json
{
  • "count": 0,
  • "credibility": 0,
  • "did": "string"
}

Request review with the specified signature.

path Parameters
signature
required
string
Example: PDSpnKtHioXykdBCMA15y5cLuYrRbSexscvySt_ryjppDWaW1I1AijjWercZE6K-cbS18bCwSmgIPqRIuL-cow

Signature of the review being requested.

Responses

Response samples

Content type
{
  • "did": "string",
  • "jwt": "string",
  • "kid": "string",
  • "original_sub": "string",
  • "payload": {
    },
  • "signature": "string"
}

Request reviews matching the provided query.

query Parameters
q
string
Example: q=restaurants in zurich

Search for reviews that have this string in sub or opinion field.

signature
string

Review with this signature value.

signature_prefix
string
Example: signature_prefix=dBjftJeZ

Reviews whose signature starts with this base64url string. A prefix with any other character fails with status 400. A prefix identifies a review for as long as that review is the only one it matches.

kid
string
Example: kid=-----BEGIN PUBLIC KEY-----MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEDo6mN4kY6YFhpvF0u3hfVWD1RnDElPweX3U3KiUAx0dVeFLPAmeKdQY3J5agY3VspnHo1p/wH9hbZ63qPbCr6g==-----END PUBLIC KEY-----

Reviews by issuer with the following PEM public key.

did
string
Example: did=did:plc:z72i7hdynmk6r22z27h6tvur

Reviews by every key bound to the identity with this DID.

alias
string
Example: alias=bsky.app

Reviews by every key bound to the identity that verified this alias, given without its scheme.

iat
integer <int64>

Reviews issued at this UNIX time.

gt_iat
integer <int64>

Reviews with UNIX timestamp greater than this.

scheme
string
Example: scheme=geo

Reviews of subjects with this URI scheme.

sub
string <uri>

Reviews of the given subject URI. For a geo: URI, reviews whose location lies within the u radius around the given coordinates, extended by each review's own u value, and whose q name equals the given one without case, punctuation and accents. A review or a query without a name matches on location alone. Subjects joined by an accepted equivalence claim are included.

bbox
string
Example: bbox=5.9,45.8,10.5,47.8

Reviews of places inside this box, written xmin,ymin,xmax,ymax in degrees of longitude and latitude. Each minimum must not exceed its maximum, so a box across the antimeridian takes two requests. -180,-90,180,90 covers the whole world. An edited review matches by the place of the review it edits.

rating
integer <int16> [ 0 .. 100 ]

Reviews with the given rating.

opinion
string

Reviews with the given opinion.

limit
integer <int64> >= 1

Maximum number of reviews to return. Without it, a response holds at most 1000 reviews as JSON, 3000 as CSV and 500 as N-Triples. A limit above 3500 for JSON and N-Triples or above 7000 for CSV fails with status 400, and a response over 5.8 MB fails with status 413.

offset
integer <int64> >= 0

Number of reviews to skip before returning results. Used for pagination. Must be non-negative.

opinionated
boolean

Only reviews which either contain or do not contain an opinion.

examples
boolean

Include reviews of test subjects: pages on example.com, example.org and example.net, places within 0.01 degrees of geo:0,0 in latitude and longitude, urn:isbn:9780000000002, urn:gs1:01:09520000000004, and LEIs starting with 0000000000. A query for one subject or one signature includes them regardless.

min_credibility
number <float> [ 0 .. 1 ]
Example: min_credibility=0.4

Reviews whose reviewer has a credibility of at least this value. The reviewer is the identity the key was bound to when the review was signed, else the key. A reviewer without a stored credibility fails.

issuers
boolean

Include aggregate information about review issuers.

maresi_subjects
boolean

Include aggregate information about reviews of returned reviews.

latest_edits_only
boolean

For edited reviews, return only the most recent version (true by default)

action
string
Example: action=equivalence

Reviews with this action: edit, report_abuse, equivalence or identity. * matches every action. Without it, the query leaves out equivalence and identity claims.

Responses

Response samples

Content type
{
  • "issuers": {
    },
  • "maresi_subjects": {
    },
  • "reviews": [
    ]
}

Request the number of reviews each client wrote.

query Parameters
gt_iat
integer <int64>

Count reviews with a UNIX timestamp greater than this. Without it, reviews of any date count.

Responses

Response samples

Content type
application/json
{
  • "clients": {
    }
}

Request aggregate information about the subject.

path Parameters
sub
required
string
Example: https://nytimes.com

Request aggregate information about the subject.

Responses

Response samples

Content type
application/json
{
  • "confirmed_count": 0,
  • "count": 0,
  • "opinion_count": 0,
  • "positive_count": 0,
  • "quality": 0,
  • "rating": 0,
}

Submit a new review or perform actions on existing reviews, with the JWT as the body

Submit a Mangrove Review as a JWT in the request body, as plain text. The server handles it as PUT /submit/{jwt_review} handles the JWT of its path, and the description of that operation gives the format and the payload types.

A browser sends a POST with a text/plain body without a CORS preflight, so a submission costs one request. A body is free of the length limit of a URL, so a review of any allowed length fits. Leading and trailing whitespace of the body is ignored.

Request Body schema: text/plain
required

JWT string in format header.payload.signature.

string

Responses

Submit a new review or perform actions on existing reviews Deprecated

Submit a Mangrove Review as a JWT. The system automatically detects the operation type based on the payload structure.

Resources

Request Format

Standard JWT format: header.payload.signature

Header must include:

  • alg: "ES256" (ECDSA P-256)
  • typ: "JWT"
  • kid: Public key in PEM format

Payload is one of these types (see Payload schema in the API documentation):

  • Review: Review any subject (requires sub (non-maresi), rating)
  • Rating: Rate a review (requires sub (maresi), rating)
  • Comment: Comment on a review (requires sub (maresi), opinion)
  • Edit: Edit your review (requires sub (maresi), action: "edit", same key)
  • Delete: Delete your review (requires sub (maresi), action: "delete", same key)
  • ReportAbuse: Report abuse (requires sub (maresi), action: "report_abuse")
  • Equivalence: Assert that two subjects of one scheme are the same entity (requires sub, action: "equivalence", opinion containing the target subject URI of the scheme of sub)
  • Identity: Bind the signing key to an identity (requires sub (DID), action: "identity", a DID document that lists the key)
  • Profile: Publish the reviewer details of an identity (requires sub (DID), action: "profile", a key bound to the DID). Its metadata holds only nickname, given_name, family_name, gender, birthdate as a year of four digits, and client_id. The latest profile by iat is the current one, and GET /identity/{id} returns it. A profile must be dated after the current one and change its details

Signature: ECDSA P-256 signature using the private key corresponding to the public key in header.

Key Concepts

  • Maresi URIs (urn:maresi:{signature}): Reference existing reviews for interactions and actions. A maresi URI must name an original review, and the server refuses one that names an edit
  • Subject URIs: Regular URIs (https://, geo:, isbn:, gs1:, lei:) for reviewing actual subjects
  • Timestamps: All iat fields must be non-negative Unix timestamps at most one hour after server time
  • Authentication: Edit and delete operations require the same public key as the original review, or a key bound at submission time to the identity of the original review
  • Deletion: A delete removes the review and its edits, and the server stores the delete. Comments, ratings and reports of other reviewers stay. A second submission of a deleted review, of one of its edits or of the delete itself is refused
path Parameters
jwt_review
required
string <JWT>
Example: eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ii0tLS0tQkVHSU4gUFVCTElDIEtFWS0tLS0tTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFcDc4Zms1eUNqYmlZYXZ5UjZGQ2xxcTlBRkJUaXpBSG1ZdU9rcTR3cy9aYmdleG41SVQ2bi83NGt2YlZ0UGxNc3A5Z2luTysxMVZ4ZUorbVFJQ1pZamc9PS0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLSIsImp3ayI6IntcImNydlwiOlwiUC0yNTZcIixcImV4dFwiOnRydWUsXCJrZXlfb3BzXCI6W1widmVyaWZ5XCJdLFwia3R5XCI6XCJFQ1wiLFwieFwiOlwicDc4Zms1eUNqYmlZYXZ5UjZGQ2xxcTlBRkJUaXpBSG1ZdU9rcTR3c19aWVwiLFwieVwiOlwiNEhzWi1TRS1wXy0tSkwyMWJUNVRMS2ZZSXB6dnRkVmNYaWZwa0NBbVdJNFwifSJ9.eyJpYXQiOjE1ODA5MTAwMjIsInN1YiI6Imh0dHBzOi8vbWFuZ3JvdmUucmV2aWV3cyIsInJhdGluZyI6NzUsIm9waW5pb24iOiJHcmVhdCB3ZWJzaXRlIGZvciByZXZpZXdzLiIsIm1ldGFkYXRhIjp7Im5pY2tuYW1lIjoiam9objEyMyIsImNsaWVudF9pZCI6Imh0dHA6Ly9sb2NhbGhvc3Q6MzAwMCJ9fQ.7xQtIlHuDdCVioyztj8i3zJ8dk3oCSfKr6VCR5RtBn6sBcqvpfyvs13PlKGJoamKzx8xUgQTQJjRPv5s91-VLQ

JWT string in format header.payload.signature. When decoded, the JWT contains: kid (public key in header), payload (Payload schema with review data), and signature (ECDSA signature). Use the JWT Inspector to construct and validate JWTs. For test reviews, put a test subject in the sub field: a page on example.com, example.org or example.net, a place at geo:0,0, urn:isbn:9780000000002, urn:gs1:01:09520000000004, or an LEI starting with 0000000000, such as urn:lei:00000000000000000098. A test subject skips external resource validation, and listings leave its reviews out unless the query sets examples.

Responses

Dump

Triggers a dump of all reviews to S3 in all supported formats

This endpoint dumps all reviews from the database to S3 in three formats:

  • JSON (with reviews, identities, the results and time of the latest aggregation, and the format version)
  • CSV
  • N-Triples RDF

Returns a list of results with S3 keys and presigned download URLs valid for 7 days.

Requires X-API-Key header with valid API key.

Authorizations:
api_key

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Downloads every stored record in one file

A dump holds every record the database stores:

  • reviews, with every version of an edited review
  • deletes, comments, reactions and abuse reports. A delete stays after the review it names is gone, and its kid is the key of the author.
  • equivalence and identity claims

The backup job writes a new dump once a day, and this endpoint serves the most recent one. The Accept header picks the format:

  • application/json (default): the shape of a /reviews response, with reviews, and issuers and maresi_subjects set to null. Each record carries its action. A record whose sub is a maresi URN names an original review and carries original_sub, the subject of that review. The versions of a review are the review and the edits whose sub names it, and the latest version has the largest iat, then signature. A comment, reaction, delete or report belongs to the review its sub names. An identities array holds every reviewer identity the server knows: did, source, the last resolved document, and the log of a did:plc in the shape of /identity/{id}/log, empty for a did:web. A fork rebuilds every identity and its key bindings from this file alone. The server increments format_version whenever the shape of a section or the meaning of a field changes. aggregated_at is the unix time in seconds at which the aggregator last committed its scores. Three more sections hold the results of that aggregation:
    • equivalences: the members of the accepted equivalence classes, as /equivalences returns them. Members with one canonical_sub are one subject, and a client shows their reviews together. A later aggregation can name a class by another member, so a client regroups the members from each dump instead of keeping canonical_sub as an identifier.
    • credibility: the credibility of each reviewer from 0 to 1, keyed by their DID when an identity claim bound their key, else by the key. A key that becomes bound changes its entry to the DID. The documents in identities bind keys to DIDs.
    • subjects: sub, quality (0 to 10000) and confidence of each subject the aggregator scored.
  • text/csv: one row per record. A browser asks for text/html and gets this format.
  • application/n-triples: the records as RDF triples.

CSV and N-Triples leave out claims and deletes.

The response is a 307 redirect to a download link that expires after 7 days. Use curl -L to follow it.

header Parameters
Accept
string or null

Dump format to retrieve: application/json (default), text/csv, text/html, application/n-triples

Responses

Identity

Resolve a DID, or a verified alias, to the identity.

path Parameters
id
required
string
Example: did:plc:z72i7hdynmk6r22z27h6tvur

A did:plc or did:web identifier, or a verified alias without its scheme, such as alice.bsky.social or www.openstreetmap.org/user/alice.

query Parameters
fresh
boolean

Ask the sources again instead of answering from the cache, when the last resolution is more than a minute old.

Responses

Response samples

Content type
application/json
{
  • "aliases": [
    ],
  • "did": "string",
  • "document": { },
  • "profile": { },
  • "source": "string"
}

Operation log of a did:plc identity kept by this registry.

path Parameters
id
required
string
Example: did:plc:z72i7hdynmk6r22z27h6tvur

A did:plc identifier.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Append signed did:plc operations to the registry.

path Parameters
id
required
string

The did:plc identifier the operations belong to.

Request Body schema: application/json
required

Signed did:plc operations, oldest first. The genesis operation must be included or stored already. The body may be at most 8 KB and an identity may have at most 100 operations.

Array
object

Responses

Request samples

Content type
application/json
[
  • { }
]

Response samples

Content type
application/json
{ }

Publish a did:plc identity to the PLC directory.

Replay the registry log of the DID to the PLC directory, so AT Protocol software resolves the identity. Each operation carries its own signature and the log is public at GET /identity/{id}/log, so any client may ask. The replay skips the operations the directory holds, and a second call completes a replay the directory interrupted.

path Parameters
id
required
string
Example: did:plc:z72i7hdynmk6r22z27h6tvur

A did:plc identifier.

Responses

Response samples

Content type
application/json
{
  • "did": "string",
  • "url": "string"
}