Authentication#

If you use Agentic Wallet#

Agentic Wallet supports two authentication methods:

Create or access your wallet with just an email — no developer account or API key required. Ideal for getting started quickly.

  1. 1
    Talk to your Agent
    plaintext
    Log in to Agentic Wallet with email
  2. 2
    Enter your email
    plaintext
    <email>
  3. 3
    Enter the verification code
    plaintext
    <otp-code>
Note
Private keys are generated and stored in a TEE environment and are never exposed to anyone, including your Agent. Logging in again with the same email will restore your existing wallet — no need to recreate it.

If you use Open API#

You can also authenticate using an API Key for Onchain OS Skills/Open API. You'll need to create a project and generate an API key in the developer management portal first. For detailed steps and resources, refer to here.

All API requests must include the following headers for authentication:

  • OK-ACCESS-KEY: API key
  • OK-ACCESS-TIMESTAMP: Request timestamp (UTC), in ISO format, e.g. 2020-12-08T09:08:57.715Z
  • OK-ACCESS-PASSPHRASE: The passphrase specified when creating the API key
  • OK-ACCESS-SIGN: Signature

Signing steps:

  1. 1
    Concatenate pre-hash string
    Concatenate timestamp, method, requestPath, and body into a single string.
  2. 2
    HMAC SHA256 signature
    Sign the pre-hash string with the secret key (generated when creating the API key).
  3. 3
    Base64 encode
    Encode the signature result using Base64.
Example
For example, sign=CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA256(timestamp + 'GET' + '/api/v6/dex/aggregator/swap', SecretKey)). The timestamp must match OK-ACCESS-TIMESTAMP. GET is the method (HTTP request method, all uppercase). /api/v6/dex/aggregator/swap is the requestPath. The body is empty — it can be omitted if there is no request body (typically for GET requests).
Note
The timestamp must not differ from the server time by more than 30 seconds. POST requests must include the raw request body in the signature calculation. The secret key is only visible at creation time — store it through a secure channel.

Postman is a popular API development and testing tool that allows developers to design, test, and document APIs. It provides a user-friendly graphical interface for sending HTTP requests to APIs.

If you haven't installed Postman yet, you can download it for free from the Postman website: https://www.postman.com/

Tip
This example requires a basic understanding of Postman.
  1. 1
    Add Parameters

    This typically applies to GET requests. If your request requires query parameters, you can add them as key-value pairs under the Params tab.

  2. 2
    Set Headers

    Under the Headers tab, add the following key-value pairs:

    • OK-ACCESS-KEY
    • OK-ACCESS-PASSPHRASE

  3. 3
    Add Body

    This typically applies to POST requests. If your request requires a request body, you can add it under the Body tab:

    • Select raw and JSON from the dropdown menu
    • Enter your request body in JSON format

  4. 4
    Set Pre-request Script

    Used to generate the required signature (OK-ACCESS-SIGN) and timestamp (OK-ACCESS-TIMESTAMP). Under the Pre-request Script tab, insert the script corresponding to your request type (GET requests exclude the request body; edit the secret key as needed).

    GET request:

    javascript
    var method = pm.request.method;
    var now = new Date();
    var isoString = now.toISOString();
    var path = pm.request.url.getPathWithQuery();
    var sign = CryptoJS.enc.Base64.stringify(
      CryptoJS.HmacSHA256(
        isoString + method + path,
        pm.variables.replaceIn('{{secret_key}}')
      )
    );
    
    pm.request.headers.add({
      key: 'OK-ACCESS-SIGN',
      value: sign,
    });
    
    pm.request.headers.add({
      key: 'OK-ACCESS-TIMESTAMP',
      value: isoString,
    });
    

    POST request:

    javascript
    var method = pm.request.method;
    var now = new Date();
    var isoString = now.toISOString();
    var path = pm.request.url.getPathWithQuery();
    var bodyStr = pm.request.body.raw;
    var sign = CryptoJS.enc.Base64.stringify(
      CryptoJS.HmacSHA256(
        isoString + method + path + bodyStr,
        pm.variables.replaceIn('{{secret_key}}')
      )
    );
    
    pm.request.headers.add({
      key: 'OK-ACCESS-SIGN',
      value: sign,
    });
    
    pm.request.headers.add({
      key: 'OK-ACCESS-TIMESTAMP',
      value: isoString,
    });