Skip to content
CARP Docs
Ask AISystemLightDark
On this page

Backend API

The REST API of CARP Web Services (CAWS), generated from the OpenAPI document of its server.

Copy MarkdownOpen inOpen in GitHubView as MarkdownOpen in Scira AIOpen in ChatGPTOpen in ClaudeOpen in Cursor

The CARP Web Services (CAWS) REST API is how clients work with CARP's server. It manages studies, protocols and deployments, and receives the data that participants' phones upload.

Apps built with CARP Mobile Sensing (CAMS) call the API through the carp_webservices package. For the app side, see CARP Web Services.

The endpoint pages are generated from the OpenAPI document of the CAWS server at https://dev.carp.dk. Each docs build fetches the document again, so the pages show the API as it was at the last build.

Authentication

Endpoints need an access token from CARP's Keycloak server, sent in the Authorization header as Bearer <token>. The OpenAPI document describes the OAuth 2.0 password flow, with the token URL https://dev.carp.dk/auth/realms/Carp/protocol/openid-connect/token. Request the token with the scopes openid profile email carp; the playground's Authorize dialog selects them by default.

The self sign-up endpoint is public: it creates an anonymous participant account from a study code. The OpenAPI document does not mark it as public, so its page lists the token too.

Service endpoints

CAWS hosts the application services of CARP Core. Each service takes its requests at one endpoint, as CARP Core request objects such as CreateStudy. Its page lists the response that each request returns:

ServiceEndpointRequests
Study servicePOST /api/study-serviceCreate, configure and remove studies, and set them live
Recruitment servicePOST /api/recruitment-serviceAdd participants, and invite and stop participant groups
Protocol servicePOST /api/protocol-serviceAdd, update and get study protocols and their versions
Protocol factory servicePOST /api/protocol-factory-serviceCreate a custom protocol
Deployment servicePOST /api/deployment-serviceCreate and stop study deployments, and register devices
Participation servicePOST /api/participation-serviceGet invitations, and get and set participant data
Data stream servicePOST /api/data-stream-serviceOpen, append to, read, close and remove data streams

The compressed data stream endpoint, POST /api/data-stream-service-zip, takes the same requests gzip-compressed, although the OpenAPI document declares a JSON body. For how request objects work, see Request objects in CARP Core.

Besides the services, the groups hold resource endpoints, such as study researchers, documents, collections, files and exports.

API playground

Each endpoint page has a playground that sends the request from your browser. CAWS rejects the CORS preflight request of every endpoint that needs a token. From this site, the playground therefore reaches only the public self sign-up endpoint. To send other requests, use the Swagger UI on the server or your own client.

Next steps

CARP Web Services

Upload data to CAWS from a CAMS app.

Study service

Create, configure and remove studies, and set them live.

Architecture

How the CARP components fit together, from study protocol to data upload.

Quick links

Page · DocumentationCARP DocumentationPage · DocumentationIntroductionPage · DocumentationQuickstartPage · DocumentationTerminologyPage · DocumentationArchitecture