Auth Guide
Learn how to make authorized and authenticated calls to 1upHealth's APIs

Generating a New User Authorization Code

1upHealth utilizes the oAuth2 process which entails generating an authentication code and exchanging it for an access token. Generate the authentication code by requesting the user management api with the client_id, client_secret, oneup_user_id and/or app_user_id.
1
curl -X POST "https://api.1up.health/user-management/v1/user/auth-code"
2
-d "client_id=clientidclientidclientid"
3
-d "client_secret=clientsecretclientsecret"
4
-d "app_user_id=myappsuserid"
Copied!
Sample Response:
1
{
2
"success": true,
3
"code": "75b74e18e1504fde865f40f4308317b2",
4
"oneup_user_id": 62198,
5
"app_user_id": "akuafo100",
6
"active": true
7
}
Copied!

Getting an access token

Then use the generated authentication code to exchange for the access token, using the ‘client_id’, ‘client_secret’, ‘grant_type=token’, and ‘app_user_id’.
1
curl -X POST "https://auth.1up.health/oauth2/token"
2
-d "client_id=clientidclientidclientid"
3
-d "client_secret=clientsecretclientsecret"
4
-d "code=codecodecodecodecodecode"
5
-d "grant_type=authorization_code"
Copied!
Sample Response:
1
{
2
"access_token": "xxxxxxxxxx",
3
"token_type": "Bearer",
4
"expires_in": 3599,
5
"refresh_token": "yyyyyyyyyy",
6
"scope": "user/*.*"
7
}
Copied!
You can test the access token by either authorizing data from a provider or creating a FHIR resource using the token. Following either step, call the Patient resource to retrieve data the data existing for this resource.

Making a FHIR Request

get
https://api.1up.health
/dstu2/Patient?query-param=queryvalue
Get Patient

Queries across all your users

You can make a request across all your users via client based authentication. This requires the client_id, client_secret, and the x-oneup-user-id headers. Rather than setting the x-oneup-user-id to an actual 1up user id, set the x-oneup-user-id string client and you can query all data for all your client's users.
1
curl -XGET 'https://api.1up.health/r4/Patient' \
2
-H 'client_id: clientidclientidclientid' \
3
-H 'client_secret: clientsecretclientsecret' \
4
-H 'x-oneup-user-id: client'
Copied!
This returns a valid FHIR response with data from all created users under this client.
1
{
2
"resourceType": "Bundle",
3
"type": "searchset",
4
"total": 20800,
5
"entry": [
6
{ ... },
7
{ ... },
8
{ ... },
9
]
10
}
11
Copied!
Last modified 2mo ago