Authentication

Authentication is crucial for ensuring that only authorized users can access private APIs. This document outlines the authentication mechanisms used for public and private APIs.

Public API

Public APIs do not require authentication. These interfaces are accessible to anyone without the need for any credentials.

No authentication is required for public interfaces.

Private API

Private APIs require authentication to ensure that only authorized users can access them. Authentication is achieved using custom headers that include a timestamp and a signature.

Auth Header

The following headers must be included in the request to authenticate access to private APIs:

Name
Location
Type
Required
Description

X-edgeX-Api-Timestamp

header

string

must

The timestamp when the request was made. This helps prevent replay attacks.

X-edgeX-Api-Signature

header

string

must

The signature generated using the private key and request details.

CURL Example

curl --location --request GET 'https://pro.edgex.exchange/api/v1/private/account/getPositionTransactionPage?filterTypeList=SETTLE_FUNDING_FEE&size=10&accountId=544159487963955214' \
--header 'X-edgeX-Api-Signature: 06d28020763542c0afc296dc8743797c6fda8ea9727745b57b671f70326dfed6077cd******************************aff3162e39d05d9df1c3ddf9648650382d6e62ff1076b14c0e6c687088d3917d8490e5412a080a6e9ea940c720ddd' \
--header 'X-edgeX-Api-Timestamp: 1736313025024'

Signature Elements

The signature is generated using the following elements:

Signature Element

Description

X-edgeX-Api-Timestamp

The timestamp when the request was made. This is retrieved from the request header.

Request Method (Uppercase)

The HTTP method of the request, converted to uppercase (e.g., GET, POST).

Request Path

The URI path of the request (e.g., /api/v1/resource).

Request Parameter/Body

The query parameters or request body, sorted alphabetically.

Request Parameter To Signature Content

The request parameters are concatenated into a single string that forms the signature content. This string includes the timestamp, HTTP method, request path, and sorted query parameters or request body, ensuring the integrity and authenticity of the request.

For example, the following request parameters are concatenated into a single string:

1735542383256GET/api/v1/private/account/getPositionTransactionPageaccountId=543429922991899150&filterTypeList=SETTLE_FUNDING_FEE&size=10

How To GET Your Private Key

To sign messages, you need to obtain your private key. This key is used to generate signatures that authorize various actions on the platform.

How To GET Your Private Key

Warning: Keep your private key secure and never share it with anyone. Anyone with access to your private key can sign messages on your behalf.

Private API Example

Private API Auth Signature: This is used for authentication. We do not want the hash computation to consume excessive CPU resources. Therefore, this will use SHA3 to hash the request body string before signing.

We provide SDKs in multiple languages to help you get started quickly.

Python SDK: make_authenticated_request

Golang SDK: requestInterceptor

Java Example

Below is a Java implementation of the Ecdsa signature algorithm. This example demonstrates how to sign a GET request using a private key.

Request Body To Body String Code Example

The following Java code example demonstrates how to convert a JSON request body into a sorted string format suitable for signature generation:

Signature Algorithm

The signature algorithm used is Ecdsa (Elliptic Curve Digital Signature Algorithm).

Last updated