Setting Up Your API Credentials

Follow our step-by-step guide to set up StockRepublic API credentials, integrate customer data, and enable social trading platform features.

Welcome to StockRepublic's API credential setup guide. Follow the steps below to obtain the necessary credentials and integrate customer data, ensuring a seamless experience with our Social Trading Platform.

Step 1: Obtain Client ID and API URL

During the onboarding process, you'll receive a Client ID and API URL from your assigned StockRepublic developer contact. You'll need the Client ID to authenticate against our API hosted at the provided URL.

# Client ID Example
client_id = "acee45f3-fe79-4f19-ba8e-51792e170029"
base_url = "https://api.stockrepublic.io"

Step 2: Generate RSA Key Pair

After obtaining your Client ID, generate a private and public RSA key pair, and share the public key with your StockRepublic developer. Once approved, you can use the private key and Client ID to create authentication tokens.

$ ssh-keygen -b 2048 -m pem -t rsa -f sr-api-key

Step 3: Create an Auth Access Token

To send data to the StockRepublic API, generate a partner authentication token using your key pair. Then, provide the token in the Partner API's Authorization header.

Step 4: Integrate End-user Data

With an auth token for the Partner API, integrate your customer data (Users, Portfolios, Transactions) with StockRepublic to enable a social trading experience. Refer to our End-user Data Integration guide or the code recipe below.

Step 5: Onboard End-users

Once user data is stored, onboard your end-users and let them create social profiles and interact with the platform.

Step 6. Create content & implement features

The end-user token lets customers engage with the social trading platform, create posts, follow members, and personalize their feeds. Explore our feature sets, Social Engagement, and Investment Insights for more information.