Authentication And Jobs#

Here’s a quick overview of our jobs system, and steps to access auth credentials for our APIs. Find more details on our endpoints at Property Regression and PoET, serving our core and generative workflows respectively.

Job System#

The API endpoints operate on an asynchronous POST and GET framework. By initiating a task through our POST endpoints, the system schedules the job and promptly returns a response. This approach ensures that tasks, even those with longer processing times, do not require immediate waiting. Instead, upon initiating a task, a unique job ID is provided as a response.

The job ID serves as a unique identifier for tracking each job. Utilizing this ID with our GET endpoints allows for querying the task’s status. If the job is still in progress, the API will indicate that the job is in progress. Once the job has completed, the same endpoint can be used with the job ID to retrieve the results. Additionally, the /jobs endpoints are available for polling the status of a task before retrieving all the results.

The API follows this design to ensure efficient task management without unnecessary waiting times.

It is important to note to retain the unique job IDs provided upon initiating a task, as it is necessary for retrieving the corresponding results.

Login#

Steps to Log in#

On this page#

Login directly on this page using the Authorize button. This action will allow browsing of the API documentation and execute test queries directly in the browser.

Within your IDE#

For programmatic authorization, retrieve an access token through our /login endpoint, then include this in the header of subsequent requests to authorize access. A Python example using the Requests library is provided below:

import requests

# Get the access token using your login credentials:
r = requests.post("https://openprotein.ai/api/v1/login/user-access-token", data={"username": your_username, "password": your_password})
assert r.status_code==200

# Build the authorization header for subsequent requests
auth_header = {'Authorization': '{} {}'.format(r.json()['token_type'], r.json()['access_token'])}

# Make authorized requests to our endpoints, for instance:
example_request = requests.get("https://openprotein.ai/api/v1/jobs", headers=auth_header)
print(f"Example request has status {example_request.status_code}")

For easier usage, consider using session management:

with requests.Session() as sess:
    sess.headers.update(auth_header)
example_request = requests.get("https://openprotein.ai/api/v1/jobs")
print(f"Example request has status {example_request.status_code}")

Jobs#

Endpoints to track job status for asynchronous jobs. Use these to verify the status (PENDING, RUNNING, SUCCESS) of jobs and view basic metadata (e.g., job creation date). Here is a simple example where we submit an MSA (multiple sequence alignment) request and then fetch the result:

# Example of jobs
seed_sequence = "MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN" # Human INS sequence
example_request = requests.post("https://openprotein.ai/api/v1/align/msa", files={"msa_file":seed_sequence.encode()}, headers=auth_header)
job_id = example_request.json()['job_id']
print(f"Example request has status {example_request.status_code} and jobid {job_id}")

# will be PENDING and then SUCCESS
response = requests.get("http://openprotein.ai/api/v1/align/msa", params={"job_id":job_id}, headers=auth_header)
print("status", response.headers['job_status'])
print("Generated MSA: ", response.text)

Endpoints#