Skip to main content

Quick Start

Get up and running with the Oproto API in just a few minutes.

Prerequisites

  • An Oproto account with API access
  • Your client credentials (client ID and secret)

Step 1: Get an Access Token

First, obtain an access token using your client credentials:

curl -X POST https://auth.oproto.io/oauth2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET"

Response:

{
"access_token": "eyJraWQiOiJ...",
"token_type": "Bearer",
"expires_in": 3600
}

Save the access_token — you'll need it for all API requests.


Step 2: Make Your First Request

Let's fetch a list of companies:

curl -X GET https://api.oproto.io/v1/companies \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json"

Response:

{
"data": [
{
"id": "comp_abc123",
"name": "Acme Corporation",
"status": "active",
"createdAt": "2024-01-15T10:30:00Z"
}
],
"pagination": {
"hasMore": false,
"totalCount": 1
}
}

Step 3: Create a Resource

Create a new company:

curl -X POST https://api.oproto.io/v1/companies \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "New Company Inc",
"status": "active"
}'

Response:

{
"id": "comp_def456",
"name": "New Company Inc",
"status": "active",
"createdAt": "2024-01-15T11:00:00Z"
}

Next Steps

Now that you've made your first API calls, explore:


Code Examples

JavaScript

const accessToken = 'YOUR_ACCESS_TOKEN';

// Fetch companies
const response = await fetch('https://api.oproto.io/v1/companies', {
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
}
});

const { data: companies } = await response.json();
console.log(companies);

Python

import requests

access_token = "YOUR_ACCESS_TOKEN"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}

response = requests.get(
"https://api.oproto.io/v1/companies",
headers=headers
)

companies = response.json()["data"]
print(companies)

C# / .NET

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", accessToken);

var response = await client.GetAsync("https://api.oproto.io/v1/companies");
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);

Need Help?