Skip to content

Invitations

An invitation lets someone without a role review a specific instance. An invited user can read it in the in-progress stage and comment on it. They can't change it, and they get no access to its released version through the invitation.

An invitation can extend to the instances around it through scopes.

flowchart LR
    E["Editor"] -- "invites, for scope 'overview'" --> R["Reviewer"]
    R -. "read + comment" .-> D["Dataset"]
    R -. "read + comment" .-> P["Person (in scope)"]
    R -. "read + comment" .-> O["Organization (in scope)"]
    R -. "no access" .-x X["Unrelated instance"]

Invited instances are treated as readable everywhere: when reading them directly, listing instances, running queries, summarizing links and evaluating scopes.

Inviting needs the functionality INVITE_FOR_REVIEW, granted by EDITOR or stronger.

Invite someone who already has an account

  1. Find the user

    GET /v4/invitations/instances/{id}/candidates?search=lovelace
    

    search needs at least 3 characters and matches an exact email address, or part of the username or name. It returns at most 20 people who have logged in before, as {id, username, name}.

  2. See which scopes are available

    GET /v4/invitations/instances/{id}/scopes
    
  3. Invite them

    PUT /v4/invitations/instances/{id}/users/{userId}?scope=overview&scope=fieldwork
    

    The invitation applies to the combination of the named scopes. Without a scope, it covers only the instance itself. Inviting again replaces the scopes, and an unknown scope name is rejected with 400.

To withdraw an invitation, use DELETE /v4/invitations/instances/{id}/users/{userId}. Listing the users invited to an instance with GET /v4/invitations/instances/{id}/users needs the global functionality LIST_INVITATIONS.

Invite someone who hasn't logged in yet

An invitation link works for people who don't have a user in MarmotGraph yet.

sequenceDiagram
    actor Editor
    participant Client as Your application
    participant Core
    actor Reviewer

    Editor->>Client: Invite a reviewer
    Client->>Core: POST /invitations/instances/{id}/pending
    Core-->>Client: token (returned only this once)
    Client->>Reviewer: Sends a link containing the token
    Reviewer->>Client: Opens the link and logs in
    Client->>Core: POST /invitations/redemption {token}
    Core-->>Client: {instanceId}
    Client->>Reviewer: Shows the instance
POST /v4/invitations/instances/{id}/pending
Content-Type: application/json

{ "label": "Link for the external review board", "scopes": ["overview"] }

Both properties are optional. The label is free text of up to 255 characters, so you can recognize the invitation later.

{
  "data": {
    "id": "...",
    "label": "Link for the external review board",
    "scopes": ["overview"],
    "createdAt": "...",
    "expiresAt": "...",
    "token": "..."
  }
}

The token is shown only once

Core stores only a hash of the token, so it can't be retrieved later. Core neither sends emails nor builds links. Delivering the token is up to your application.

Things to know:

  • Each call issues a separate, single-use invitation.
  • Invitations expire after 30 days by default (configurable), and expired ones are removed daily.
  • Redeeming needs only a valid login. The token itself is the proof, and it adds its scopes to any existing invitation of that user.
  • An unknown, already used or expired token gives 404.
Action Request
List issued invitations (without tokens) GET /v4/invitations/instances/{id}/pending
Revoke DELETE /v4/invitations/instances/{id}/pending/{invitationId}
Redeem POST /v4/invitations/redemption with { "token": "..." }