MedicalTrace

Draft a credential

Create an unsigned credential for a granted claim type.

Call this as Demo Lab, while the lab is manufacturer or current custodian of the equipment. The member needs credential:issue, and the organization needs an issuer grant whose credentialType matches claimType. The seed grant is electrical_safety_inspection. Upload alone does not create this row.

1. Request URL

POST https://api.medicaltrace.net/v1/credentials/draft

2. Request parameters

ParameterInRequiredTypeDescription
AuthorizationheaderYesstringBearer token from POST /auth/login. The sample value demo.local.jwt is a placeholder.
X-Organization-IdheaderYesstringIssuer organization. Demo Lab in the sample.
equipmentIdbodyYesstringDevice the claim is about.
claimTypebodyYesstringMust match an active issuer grant.
claimsbodyYesobjectCanonical claim body. A later signature covers this version.
validFrombodyYesstringISO-8601 start of the validity window.
validTobodyYesstringISO-8601 end of the validity window.
documentDigestsbodyNostring[]Digests of the document versions this claim cites.

3. Request example

curl -s -X POST 'https://api.medicaltrace.net/v1/credentials/draft' \
  -H 'content-type: application/json' \
  -H 'authorization: Bearer demo.local.jwt' \
  -H 'x-organization-id: 33333333-3333-4333-8333-333333333333' \
  -d '{"equipmentId":"44444444-4444-4444-8444-444444444444","claimType":"electrical_safety_inspection","claims":{"result":"sample_pass","device":"DEMO-BED-001"},"validFrom":"2026-01-01T00:00:00.000Z","validTo":"2027-03-01T00:00:00.000Z","documentDigests":["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]}'

4. Response data

HTTP 201. The body below uses the fictional DEMO-BED-001 fixtures.

{
  "id": "55555555-5555-4555-8555-555555555555",
  "equipmentId": "44444444-4444-4444-8444-444444444444",
  "issuerOrgId": "33333333-3333-4333-8333-333333333333",
  "claimType": "electrical_safety_inspection",
  "lifecycle": "DRAFT",
  "status": "ACTIVE",
  "validFrom": "2026-01-01T00:00:00.000Z",
  "validTo": "2027-03-01T00:00:00.000Z"
}

5. Response fields

FieldTypeDescriptionExample
idstringCredential id for sign, revoke, and verify.55555555-5555-4555-8555-555555555555
lifecyclestringDRAFT until sign. Sign moves it to ANCHOR_PENDING.DRAFT
statusstringACTIVE, REVOKED, or SUPERSEDED. This is separate from the signature.ACTIVE