Lab Management
Operations for creating and administering a Lab: creating the dataroom, managing its LabNFT display metadata, managing members, and linking its decentralised identifier (DID).
Create Lab
Register a Kamu-backed lab (data room) for an onchain lab (OCL) that already exists onchain. The lab is identified by its canonical oclId (a 32-byte hex string, 0x-prefixed).
Prerequisite — the LabNFT must be minted first.
createLabdoes not mint anything; it attaches a dataroom to an OCL that already exists. Minting happens onchain viaOnChainLabFactory.mintAndCreateAccount, which mints the LabNFT and deploys its bound account in one transaction — see Lab Creation for the contract-level flow, or Molecule Labs for what a Lab is and howoclIdis derived from the minted token. If you'd rather not touch the contracts directly, the Molecule app does this for you in Step 1: Create Your Onchain Lab.
Admin Authorization Required: This mutation requires either a service token (JWT) from the Molecule team OR a valid Privy authentication token. The caller must be the LabNFT owner (or an authorized multisig signer) for the given
oclId.
GraphQL Mutation:
mutation CreateLab($oclId: String!) {
createLab(input: { oclId: $oclId }) {
isSuccess
message
error {
message
code
retryable
}
lab {
oclId
shortname
labAccountAddress
labNftTokenId
}
}
}Parameters:
The mutation takes a single CreateLabInput object:
oclId
String
Yes
Canonical 32-byte oclId (lowercase 0x-hex) of the onchain lab
Prerequisites:
LabNFT Ownership: You must own the LabNFT for the
oclIdor be an authorized signer for itFor individual wallets: You must be the owner
For multisig/Safe wallets: You must be one of the Safe owners
For ERC-4337 accounts: You must be an authorized account owner
Authentication: One of the following:
Service Token (recommended for automation): Obtain from Molecule team via Discord
Privy Token (for user-initiated requests): Use your authenticated Privy session
LabNFT Must Be Minted: The onchain lab (LabNFT /
oclId) must already exist onchain before registering the lab
Authentication Options:
Option 1: Service Token (Recommended for Automation)
Option 2: Privy Token (User-Initiated)
Example Request (Service Token):
Success Response:
Error Responses:
Not Authorized (No Token):
Not the LabNFT Owner:
Lab Already Exists:
How It Works:
Authentication Check: Validates service token or Privy token
Onchain Verification: Verifies you own or are an authorized signer for the LabNFT (
oclId)Lab Creation: Registers the Kamu-backed lab and its data room for the
oclIdWhitelist Update: Automatically adds your wallet address to the lab whitelist
Returns Result: Lab details if successful, error details if failed
Use Cases:
Automate Lab Creation: Register labs programmatically after minting LabNFTs
CI/CD Integration: Automatically set up data rooms for new research labs
Batch Operations: Register multiple labs for a portfolio of onchain labs
User Self-Service: Allow users to create their own lab data rooms
Getting Service Token Access:
To obtain a service token for automated lab creation:
Join our Discord community
Contact the Molecule team
Provide:
Your wallet address
Use case description
Intended automation workflow
You'll receive:
API Key (for all APIs)
Service Token (JWT for lab creation)
Token expiration date
Get Single Project with Files
Retrieve complete details for a specific lab including all files. This is a public endpoint - no authentication required. Look up a lab by its oclId or, alternatively, by its human-readable shortname — provide exactly one.
🔓 Public Endpoint: The
labWithDataRoomAndFilesquery does not require authentication. You only need thex-api-keyheader - no Service Token is needed. File-level access control is handled via encryption rather than query-level authentication.
GraphQL Query:
Example Request:
The optional CMS-enriched fields
trlValue,trlRationale, andisVerified(see List All Projects) are also available on this query and are hydrated only when requested.
LabNFT Metadata
Update LabNFT Metadata
Partial update of the LabNFT display metadata (name, description, image, externalUrl). Omitted fields are left unchanged; an explicit null clears a field.
Authorization: Restricted to the OCL admin (LabNFT owner + multisig signers).
Parameters:
oclId
String
Yes
Canonical 32-byte oclId of the lab
input
UpdateLabNftMetadataInput
Yes
Patch object (all fields optional)
UpdateLabNftMetadataInput fields (all optional): name, description, image, externalUrl.
Generate LabNFT Image Upload URL
Generate a single-use presigned PUT URL to which the OCL admin uploads a LabNFT display image. contentType must be one of image/jpeg, image/png, image/webp, image/gif, or image/svg+xml. The public URL is patched onto the lab asynchronously by the image processor once the object lands in S3.
Authorization: Restricted to the OCL admin (LabNFT owner + multisig signers).
Parameters:
oclId
String
Yes
Canonical 32-byte oclId of the lab
contentType
String
Yes
Image MIME type (image/jpeg, image/png, image/webp, image/gif, image/svg+xml)
Lab Members
List Lab Members
Return the active members of a lab (owner, contributors, viewers), sourced from the indexed ocl_user table. Expired grants are excluded.
Public query — only an API Key is required. The same data is also exposed on the public
Lab/LabRef.membersfield.
Parameters:
oclId
String
Yes
Canonical 32-byte oclId of the lab
Member fields:
walletAddress
String
Lowercased wallet address of the member
role
LabMemberRole
Effective role: OWNER, CONTRIBUTOR, or VIEWER
source
LabMemberSource
Row that defines the membership: ONCHAIN_EVENT, MULTISIG_RESOLUTION, ACCESS_CONTRACT, or ACCESS_RESOLVER_EVENT
expiry
String
Unix-seconds expiry as a decimal string; null means the grant is permanent
isAgent
Boolean
True if the member is an agent identity (surfaced for UI; not used for authorization)
grantedAt
String
ISO-8601 timestamp the row was first persisted
DID Linking
Get DID Link Status
Public read-only snapshot of DID-linking state for an OCL. DID-linking runs automatically in the background after createLab; this query is for diagnostic and support visibility. No authentication required.
Parameters:
oclId
String
Yes
Canonical 32-byte oclId of the lab
status is a DidLinkingStatus: PENDING, SUBMITTED, LINKED, or FAILED (null before the first linking attempt). linkedDidCount reflects the number of active onchain DID links observed by the event indexer.
Last updated