Authentication
Code Ocean uses Access Tokens to authenticate requests. You can view and manage your access tokens from within your Dashboard under Access Tokens.
Was this helpful?
Code Ocean uses Access Tokens to authenticate requests. You can view and manage your access tokens from within your Dashboard under Access Tokens.
Sign in to Code Ocean.
Click Account.
Click Access Tokens.
Click Generate New Token.
Provide the Token Name.
Select Scopes allows you to select permissions for each resource.
Click Add Token.
Click Copy to copy the Token, or click Copy Token & Create Secret to copy the token and store it as a secret in your Code Ocean account.
Click Save Changes.

The access token only shows when it is created, so be sure to copy it or click Copy Token & Create Secret to copy the token and store it as a secret in your Code Ocean account.
You will not be able to access it again.
By adding the access token as a secret in your Code Ocean account, it will be easily accessible in a Capsule. See the Accessing a Secret in a Capsule page for more information.
Navigate to Account.
Click Access Tokens and a list of Access Tokens will be shown.
Next to the Token, click the garbage can
.

Click Delete.
Authentication to the API is performed via HTTP Basic Auth. Provide your access token as the basic authentication username value. You do not need to provide a password.
Use your access token when creating a CodeOcean client. The Python library will then automatically send this key in each request.
Was this helpful?
Was this helpful?
curl https://{domain}/api/v1/capsules/4bc97533-6eb4-48ac-966f-648548a756d2 \
-u "cop_d23dasd312"$ pip install codeoceanfrom codeocean import CodeOcean
client = CodeOcean(domain="https://{domain}", token="cop_d23dasd312")