Shaipup

Using the Google Sheets Addon


On this page

Welcome to the TerraCipher Shaip Integration Guide — your starting point for connecting directly with the cutting edge of research and innovation. Whether

Shaips (short for Shareable Algorithms in Practice) give organisations a fast, low-cost, and low-risk way to test, evaluate, and integrate state-of-the-art algorithms and models developed inside universities and research institutions.

Instead of spending months on discovery, contracting, or replication, companies can plug directly into ready-to-use, hosted algorithms — securely, via API — and start experimenting within hours.

Integrating with Shaips lets you:

You’ll need to add Shaips to your Library before you are able access them via the API, to do so go to Access Shaips → Adding Shaips to your Library.

Authentication and Authorisation

The Shaipup API leverages industry standards like OAuth2 and OpenID Connect for authentication. Shaipup provides all the necessary boiler plate code snippets for you to quickly integrate other Shaips into your applications.

<aside>

💡

Note: We are working on a CLI as well as language specific SDKs to make integration even easier. Please let us know which languages you want us to prioritise.

</aside>

Access boiler plate code snippets.

You can access all the boiler plate code snippets to the Shaips you have access to in your Shaip Library. These will pre populate as you run through the pipeline to provide you with the completed code snippets. However in the next section Authentication and Authorisation Pipeline we’ll walk through the logic to automate the pipeline (again noting that we are producing SDKs to simplify this).

The tabs include:

  1. Authentication → To use your email and password to fetch a new ID token and refresh token.
  2. Authorisation → To use the refresh token to fetch a new ID token.
  3. Algorithm → To use a valid ID token and run the algorithm.

Screenshot 2025-10-22 at 3.08.29 PM.png


Authentication and Authorisation Pipeline

While we are providing you with pre-populated code snippets to automate the pipeline you will need to develop the logic outlined below. The following examples use Python, however you can select and choose your language of choice from the dropdown in the dashboard.

Authentication is straight forward, you use your email and password to generate an ID token and session cookie, which you can use to run an algorithm.

import requests

# Load your email and password from a secure location or environment variables
# For demonstration purposes, we will use placeholders here
base64EmailPassword = "<<BASE64(EMAIL:PASSWORD)>>"

# Authenticate using the token endpoint. 
url = "<https://shaipup.com/market/token>"
headers = {
  'Authorization': f'Basic {base64EmailPassword}'
}

response = requests.request("GET", url, headers=headers)

# Extract the ID token and cookie from the response headers
idToken = response.headers.get("Authorization")
cookie = response.headers.get("Set-Cookie")

print(idToken)
print(cookie)

Once generated you can then use the ID Token and Cookie to run the algorithm. However ID tokens only last an hour so you don’t want to be sending your email and password across in hourly requests to get a new ID token, that’s what refresh tokens are for. Jump to the Authentication and Authorisation Pipeline to understand how to implement refresh tokens.

import requests
import json

url = "<https://shaipup.com/market/shaip?owner=uominnovationfactory&shaip=carbonforkprint>"

payload = json.dumps([
   {
      "url": "<https://www.recipetineats.com/chocolate-cake/>"
   }
])
headers = {
  'Authorization': idToken,
  'Content-Type': 'application/json',
  'Cookie': cookie
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Authentication and Authorisation Pipeline

Rather using your email and password in every call to fetch a new ID token, you can use the refresh token in the return body to refresh your ID token. You can access the refresh token and it’s expiry date in the return body to build the logic to automate token refreshing. Refresh tokens are longer lived, lasting 1 week, where as ID tokens expire after an hour.

import requests
import json

# Load your email and password from a secure location or environment variables
# For demonstration purposes, we will use placeholders here
base64EmailPassword = "<<BASE64(EMAIL:PASSWORD)>>"

url = "<https://shaipup.com/market/token>"
headers = {
  'Authorization': f'Basic {base64EmailPassword}'
}

response = requests.request("GET", url, headers=headers, data=payload)

# Extract the ID token from the response headers
idToken = response.headers.get("Authorization")
cookie = response.headers.get("Set-Cookie")

# Extract the refresh token and its expiration from the response body
responseBodyJson = json.loads(response.text)
refreshToken = responseBodyJson.get("refreshToken")
print(refreshToken)
refreshTokenExpires = responseBodyJson.get("refreshTokenExpires")
print(refreshTokenExpires)

# Use the refresh token to get a new ID token from the refreshtoken endpoint
url = "<https://shaipup.com/market/refreshtoken>"
headers = {
  'Authorization': f'Bearer {refreshToken}',
  'Cookie': cookie
}

refreshTokenResponse = requests.request("GET", url, headers=headers)

newidToken = refreshTokenResponse.headers.get("Authorization")
print(newidToken)

While the logic above shows you how to first get a refresh token and then use it to refresh your ID token, once you have a refresh token this logic is in some sense backwards. In an automated pipeline the logic should be as follows.

  1. Try and use the Algorithm API with your current ID token. If it succeeds WINNER!
  2. If it fails because the ID token is expired - check whether the refresh token is still valid.
  3. If not (it’s expired) - use the /token endpoint with your email and password to fetch a new ID token, cookie and refresh token.
  4. If it is (still valid) - use the refresh token to fetch a new ID token using the /refreshtoken endpoint.