Guide: Connecting to the API

Prev Next

This feature is currently under feature flag

If your account does not contain some features indicated in this article, please reach out to your account manager or customer success manager.

This step by step guide will indicate you how to access the API in a simple way. There is a sample script at the end of the page that summarizes the workflow.

Creating an application

To create a new application, you will need to go under the Settings > OAuth menu. You need to be an organization admin to be able to do that.

In the scope in this guide, you will need to select Client Credentials, and store the ID and the secret that will be generated at this moment. You will then need to update the permissions of the service user that was created in your organization.

Obtaining access tokens

Using client credentials workflow

To be able to use client credentials workflow, you will need to :

  • Have your OAuth application configured with this workflow and with sufficient scopes,

  • Give sufficient permissions to the service user created in your organization associated with this application.

To obtain your access token you will need to make the following HTTP call, with the authorization header being your-client-id:your-client-secret base64 encoded.

POST /oauth/token HTTP/1.1
Host: cloud-api.prevu3d.com
Authorization: Basic eW91ci1jbGllbnQtaWQ6eW91ci1jbGllbnQtc2VjcmV0
Content-Type: application/x-www-form-urlencoded
Content-Length: 28

grant_type=client_credentials

The response will be a JSON response looking like :

{
  "hasError": false,
  "expiresIn": -1752054750,
  "accessToken": "eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImQyOGQyMDk4LWM4NDQtNDQ5OS1iY2M0LWI1YmUxM2YxNDAxMSIsImZpcnN0TmFtZSI6IkNDVGVzdCBSZWFsIiwibGFzdE5hbWUiOiJPQXV0aCBBcHBsaWNhdGlvbiIsImVtYWlsIjoib2F1dGgtZjExNDMyZTgtMGJjZS00ZWFjLTkyMjctODZlZWRkYWRkMzI5QHNlcnZpY2VhY2NvdW50IiwicmVmcmVzaFRva2VuSWQiOiJhM2NlYzRmYy01MmM1LTQ2YzItYjFkMC03Y2IzYzM1NDI5ODAiLCJzY29wZXMiOlsiT0F1dGgiXSwidmVyIjoxLCJraWQiOiJjbG91ZC1wbGF0Zm9ybSIsInNlc3Npb25FeHBpcmVzQXQiOjE3NTY0MzkxODksIm9hdXRoU2NvcGVzIjpbXSwib2F1dGhPcmdhbml6YXRpb25JZCI6ImFkZWY3Y2Q0LWEyZTEtNGE2Ny05MzI2LWE3OGUxOGJmZmFlOCIsImlhdCI6MTc1MzgxMTE4OSwiZXhwIjoxNzUzODE0Nzg5fQ.AOEhSvQIdgoU45ZaqgWtRNzanRBhpNfd9GBuFtUcmQTR_7AbiPmObKGRDau6iPqWA9UEpKoZoQss6B85PgIGdA2kAQ6ZovD0MOlN0WXg63iJtFq6K-ZIQDatiAl3wn8nTT8v9t_Q-gaiFIh_mZAPODxwqqzxgPoLfJBMgKMbqIe1nwTY"
}

You can now keep the tokens pair for further use. This token is valid for a fixed duration of 1 (one) hour. After this time, you will need to make the same call to have a new token.

Accessing the API

Once you have the access token and the refresh token, you might call the endpoint GET https://cloud-api.prevu3d.com/oauth/api-info with the access token in the Authorization header. This will give you several information about the token, including the organization, the user associated with the token, and most important the base API URL depending on the region of the organization.

Here is an example of response obtained from this route :

{
  "user": {
    "id": "0e35db64-eee1-4dc3-af96-3a5cad8b8f89",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@prevu3d.com"
  },
  "organization": {
    "id": "217ebd23-ec54-4af0-a6d6-4a441a6d1966",
    "name": "Test Organization"
  },
  "scopes": [
    "read:basic",
    "read:hierarchy"
  ],
  "issuedAt": "2025-07-23T16:06:56.788Z",
  "expiresAt": null,
  "apiUrl": "https://api-ue1.prevu3d.com/realityconnect-api"
}

All the requests to the endpoints described in this documentation should be made against the base URL described in this response.

We can test the obtained token against an endpoint described in this API.

For example browsing the organization to get the list of divisions (note the Node ID here is the organization ID) :

GET https://api-ue1.prevu3d.com/realityconnect-api/v1/nodes/217ebd23-ec54-4af0-a6d6-4a441a6d1966/browse

If everything goes well you should obtain a list of divisions in your organization.

Example script

You can use the following python script to test the workflow. You will need to edit the first lines of the file to set the information about your application.

import requests
import base64
import json

# Put your information there
client_id = "f11432e8-0bce-4eac-9227-86eeddadd329"
client_secret = "xxx"

#### No need to change anything below this line ####

base_url = "https://cloud-api.prevu3d.com"
url = f"{base_url}/oauth/token"


def main():
    # Perform the request using HTTP Basic Auth
    response = requests.post(
        url,
        data={'grant_type': 'client_credentials'},
        headers={'Authorization': f'Basic {base64.b64encode(f"{client_id}:{client_secret}".encode()).decode()}'}
    )

    # Parse the response
    if response.status_code == 200:
        token_info = response.json()
        access_token = token_info['access_token']
        print("Access Token:", access_token)
    else:
        print("Failed to retrieve token:", response.status_code, response.text)
        exit(1)

    # Call the API Info endpoint
    response = requests.get(
        f"{base_url}/oauth/api-info",
        headers={'Authorization': f'Bearer {access_token}'}
    )
    api_info = response.json()
    api_url = api_info['apiUrl']
    organization_id = api_info['organization']['id']
    print("#### API Info ####")
    print(json.dumps(api_info, indent=4))
    print("\n\n\n")

    # Browse the API to get the list of divisions
    response = requests.get(
        f"{api_url}/v1/nodes/{organization_id}/browse",
        headers={'Authorization': f'Bearer {access_token}'}
    )
    divisions = response.json()

    print("#### Divisions ####")
    print(json.dumps(divisions, indent=4))


if __name__ == "__main__":
    main()