Authentication
All endpoints in the Sharegain API require an API key. To get one, see Getting Started.
Authentication Header
http
X-SG-Authorization: [your API key]Headers
| Header | Description |
|---|---|
X-SG-Authorization | Required. Your API key, copied from Settings › API access in the lender platform |
Content-Type | Required for POST requests. application/json |
X-SG-ApiVersion | Optional. Send 1 |
Example Request
bash
curl -X GET https://api.sharegain.com/public/portfolio-analysis/quota \
-H "X-SG-Authorization: your-api-key"Authentication Errors
| Status | Meaning |
|---|---|
401 | The X-SG-Authorization header is missing |
403 | The key is not recognised, or it has been revoked |
Key Lifetime
Keys don't expire. If you need a key replaced, contact support@sharegain.com. When we rotate a key, the old one stops working immediately, so update your systems at the same time.
Security Best Practices
- Never share your API key or commit it to source control
- Store it in a secrets manager or environment variables
- Call the API only from your servers, never from a browser or mobile app
- If a key may have been exposed, ask us to replace it straight away