Introduction Rheumatoid arthritis (RA) and ankylosing spondylitis (AS) are chronic, systemic, inflammatory diseases, primarily in the musculoskeletal system. Pain and fatigue are key symptoms of RA and AS. Treatment presents a clinical challenge for several reasons, including the progressive nature of the diseases and the involvement of multiple pain mechanisms. Moreover, side effects of pain treatment pose an implicit risk. Currently, no well-controlled studies have investigated how medical cannabis affects pain and cognitive functions in RA and AS. The present study aims to evaluate the efficacy and safety of medical cannabis in the treatment of persistent pain in patients with RA and AS with low disease activity. Methods and analysis A double-blinded, randomised, placebo-controlled study of cannabidiol (CBD), followed by an open label add-on of tetrahydrocannabinol (THC) with collection of clinical data and biological materials in RA and AS patients treated in routine care. The oral treatment with CBD in the experimental group is compared with placebo in a control group for 12 weeks, followed by an observational 12-week period with an open label add-on of THC in the primary CBD non-responders. Disease characteristics, psychological parameters, demographics, comorbidities, lifestyle factors, blood samples and serious adverse events are collected at baseline, after 12 and 24 weeks of treatment, and at a follow-up visit at 36 weeks. Data will be analysed in accordance with a predefined statistical analysis plan. Ethics and dissemination The Danish Ethics Committee (S-20170217), the Danish Medicines Agency (S-2018010018) and the Danish Data Protection Agency approved the protocol. The project is registered in the European Clinical Trials Database (EudraCT 2017-004226-15). All participants will give written informed consent to participate prior to any study-related procedures. The results will be presented at international conferences and published in peer-reviewed journals.