{"openapi":"3.1.0","info":{"title":"DoseWiki Public API","version":"1.2.0","description":"Read-only access to live public articles, reagent results, molecule depictions, and effect and substance replication media. Harm-reduction education only; not medical advice.","license":{"name":"DoseWiki license and reuse terms","url":"https://dose.wiki/docs/license"}},"servers":[{"url":"https://dose.wiki/api/v1"}],"paths":{"/meta":{"get":{"summary":"Get API metadata","responses":{"200":{"description":"API metadata","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/substances":{"get":{"summary":"List public substances","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"cursor","in":"query","schema":{"type":"string"},"description":"Opaque cursor from the previous page."}],"responses":{"200":{"description":"Substance previews","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubstancePage"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/substances/{slug}":{"get":{"summary":"Get a complete public substance article","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"}}],"responses":{"200":{"description":"Article plus normalized reagent and molecule resources","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SubstanceDetail"},"meta":{"$ref":"#/components/schemas/Meta"}},"required":["data","meta"]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/substances/{slug}/reagent-tests":{"get":{"summary":"Get normalized reagent-test results","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"}}],"responses":{"200":{"description":"Authored or ProtestKit snapshot results","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ReagentTesting"},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/substances/{slug}/replications":{"get":{"summary":"List the canonical substance article replication collection","description":"The complete article showcase in canonical order, with public placement evidence and existing media rights. A known substance without media returns an empty 200; an unknown substance returns 404. No substance matching or curation is performed by this API.","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"cursor","in":"query","schema":{"type":"string"},"description":"Opaque cursor bound to this substance and ordered collection revision. Return unchanged. Malformed, foreign, stale, or out-of-range cursors return 400 invalid_cursor; discard accumulated pages and restart without a cursor after a revision change."}],"responses":{"200":{"description":"Canonical ordered collection, including an empty collection for a known substance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubstanceReplicationPage"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/replications":{"get":{"summary":"List public image, video, and audio replications","description":"Filters apply before pagination. Order is media rank first, then effect slug (unattached works first), curated within-effect position when available, and replication slug.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"cursor","in":"query","schema":{"type":"string"}},{"name":"effect","in":"query","schema":{"type":"string"}},{"name":"type","in":"query","schema":{"type":"string","enum":["image","video","audio"]}}],"responses":{"200":{"description":"Public-safe replication media","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Replication"}},"pagination":{"$ref":"#/components/schemas/Pagination"},"meta":{"$ref":"#/components/schemas/Meta"}}}}}}}}},"/replications/{slug}":{"get":{"summary":"Get one replication","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"}}],"responses":{"200":{"description":"Replication","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Replication"},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/effects/{slug}/replications":{"get":{"summary":"List replications depicting an effect","description":"All publishable works with this exact owning effect_slug OR an explicit effect_tags assignment, deduplicated. No ancestor or descendant inference. The owning effect and complete public rights/source metadata are preserved; artist-gallery display exclusions do not apply.","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"}}],"responses":{"200":{"description":"Effect replications","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Replication"}},"meta":{"$ref":"#/components/schemas/Meta"}}}}}}}}},"/molecules/{slug}.svg":{"get":{"summary":"Get a molecule SVG","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"}},{"name":"scheme","in":"query","schema":{"type":"string","enum":["dosewiki","effect-index","effect-index-dark"],"default":"dosewiki"}}],"responses":{"200":{"description":"Sandboxed SVG depiction","content":{"image/svg+xml":{"schema":{"type":"string"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/openapi.json":{"get":{"summary":"Get this OpenAPI document","responses":{"200":{"description":"OpenAPI 3.1 document"}}}}},"components":{"schemas":{"Meta":{"type":"object","properties":{"api_version":{"type":"string","const":"v1"}},"required":["api_version"],"additionalProperties":true},"Pagination":{"type":"object","properties":{"limit":{"type":"integer"},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}},"required":["limit","next_cursor","has_more"]},"SubstanceReplicationAssociation":{"type":"object","description":"Publisher-known placement evidence, not a claim that the media documents this drug's effects. Private curation lists, exclusions, and notes are never exposed.","properties":{"substance_slug":{"type":"string","description":"The substance whose collection is being read."},"basis":{"type":"string","enum":["specific_drug","drug_class","visual_disconnection","curated","unknown"],"description":"specific_drug: standalone title-drug association; drug_class: an allowed general dissociative/deliriant class rule; visual_disconnection: the canonical dissociative still-image fallback; curated: editorial placement without a more specific known basis; unknown: no recognized publisher provenance. Curated ordering alone does not change a work's basis."},"effect_slug":{"type":"string","description":"Owning effect recorded in the placement evidence, when known."},"drug_class":{"type":"string","enum":["dissociatives","deliriants"],"description":"The permitted class recorded in the placement evidence, when known."}},"required":["substance_slug","basis"],"additionalProperties":false},"SubstanceReplication":{"allOf":[{"$ref":"#/components/schemas/Replication"},{"type":"object","properties":{"association":{"$ref":"#/components/schemas/SubstanceReplicationAssociation"}},"required":["association"]}]},"SubstanceReplicationPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SubstanceReplication"},"description":"Canonical article showcase order. Key works by slug, not storage URL or order_index; preserve artist credit and rights."},"pagination":{"$ref":"#/components/schemas/Pagination"},"meta":{"allOf":[{"$ref":"#/components/schemas/Meta"},{"type":"object","properties":{"total":{"type":"integer","minimum":0},"substance_slug":{"type":"string"},"collection_label":{"type":"string"},"collection_revision":{"type":"string","pattern":"^[a-f0-9]{64}$","description":"Revision of ordered work identities and public association context, not a media-byte version or an ETag. Rotating storage URLs do not invalidate traversal."}},"required":["total","substance_slug","collection_label","collection_revision"]}]}},"required":["data","pagination","meta"]},"SubstancePreview":{"type":"object","properties":{"slug":{"type":"string"},"title":{"type":"string"},"summary":{"type":"string"},"priority":{"type":["string","null"]},"categories":{"type":"array","items":{"type":"string"}},"url":{"type":"string","format":"uri"}},"required":["slug","title","summary","categories","url"]},"SubstancePage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SubstancePreview"}},"pagination":{"$ref":"#/components/schemas/Pagination"},"meta":{"$ref":"#/components/schemas/Meta"}},"required":["data","pagination","meta"]},"SubstanceDetail":{"type":"object","properties":{"slug":{"type":"string"},"title":{"type":"string"},"summary":{"type":"string"},"identification":{"type":"object","description":"Canonical identification article section","additionalProperties":true},"classification":{"type":"object","description":"Canonical classification article section","additionalProperties":true},"dosage":{"type":"object","description":"Canonical dosage article section","additionalProperties":true},"duration":{"type":"object","description":"Canonical duration article section","additionalProperties":true},"subjective_effects":{"type":"object","description":"Canonical subjective effects article section","additionalProperties":true},"pharmacology":{"type":"object","description":"Canonical pharmacology article section","additionalProperties":true},"interactions":{"type":"object","description":"Canonical interactions article section","additionalProperties":true},"tolerance":{"type":"object","description":"Canonical tolerance article section","additionalProperties":true},"harm_potential":{"type":"object","description":"Canonical harm potential article section","additionalProperties":true},"legality":{"type":"object","description":"Canonical legality article section","additionalProperties":true},"comparisons":{"type":"array","items":{"type":"object"}},"reagent_testing":{"type":"object","additionalProperties":{"type":"string"}},"reagent_testing_normalized":{"$ref":"#/components/schemas/ReagentTesting"},"history_culture":{"type":["object","null"]},"references":{"type":"array","items":{"type":"object","additionalProperties":true}},"source_citations":{"type":["array","null"],"items":{"type":"object","additionalProperties":true}},"citations":{"type":"array","items":{"type":"object","additionalProperties":true}},"molecule":{"$ref":"#/components/schemas/MoleculeResource"},"url":{"type":"string","format":"uri"}},"required":["slug","title","summary","identification","classification","dosage","duration","subjective_effects","pharmacology","interactions","tolerance","harm_potential","legality","references","citations","molecule","url"],"additionalProperties":true},"ReagentTesting":{"type":"object","properties":{"source":{"type":"string","enum":["authored","protestkit_snapshot","none"]},"substance":{"type":["object","null"]},"results":{"type":"array","items":{"type":"object","properties":{"reagent":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"},"hint":{"type":"string"},"isReacting":{"type":"boolean"},"colors":{"type":"array","items":{"type":"object"}}},"required":["reagent","description"]}}},"required":["source","results"]},"MoleculeResource":{"type":"object","properties":{"chemical_identifiers":{"type":"object"},"schemes":{"type":"object","properties":{"dosewiki":{"$ref":"#/components/schemas/Link"},"effect-index":{"$ref":"#/components/schemas/Link"},"effect-index-dark":{"$ref":"#/components/schemas/Link"}},"required":["dosewiki","effect-index","effect-index-dark"]}},"required":["chemical_identifiers","schemes"]},"Link":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]},"Replication":{"type":"object","properties":{"slug":{"type":"string"},"title":{"type":"string"},"artist":{"type":"string"},"artist_url":{"type":"string","format":"uri"},"type":{"type":"string","enum":["image","video","audio"]},"effect_slug":{"type":"string","description":"Owning effect identity, when recorded; not necessarily the requested collection."},"effect_tags":{"type":"array","items":{"type":"string"},"description":"Explicit additional depicted-effect identities. Not ancestors or inferred related effects. Always present, empty when no additional assignments are recorded."},"url":{"type":"string","format":"uri"},"thumbnail_url":{"type":"string","format":"uri"},"preview_url":{"type":"string","format":"uri"},"motion_url":{"type":"string","format":"uri"},"motion_poster_url":{"type":"string","format":"uri"},"width":{"type":"number"},"height":{"type":"number"},"format":{"type":"string"},"file_size":{"type":"number"},"duration":{"type":"number"},"has_audio":{"type":"boolean"},"order_index":{"type":"integer"},"rights":{"type":"object","properties":{"status":{"type":"string"},"license_name":{"type":"string"},"license_url":{"type":"string"},"credit_line":{"type":"string"},"source_url":{"type":"string"},"rightsholder":{"type":"string"}},"required":["status"]}},"required":["slug","title","artist","type","effect_tags","url","format","rights"]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"meta":{"$ref":"#/components/schemas/Meta"}},"required":["error","meta"]}},"responses":{"BadRequest":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"Rate limit exceeded"},"Unavailable":{"description":"Temporarily unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}