Authentication

You'll need to authenticate your requests to access any of the endpoints in the Protocol API. In this guide, we'll look at how authentication works. Protocol offers two ways to authenticate your API requests: Basic authentication and OAuth2 with a token — OAuth2 is the recommended way.

Basic authentication

With basic authentication, you use your username and password to authenticate your HTTP requests. Unless you have a very good reason, you probably shouldn't use basic auth. Here's how to authenticate using cURL:

Example request with basic auth

curl https://docs.meveth.org/v1/conversations \
  -u username:password

Please don't commit your Protocol password to GitHub!

OAuth2 with bearer token

The recommended way to authenticate with the Protocol API is by using OAuth2. When establishing a connection using OAuth2, you will need your access token — you will find it in the Protocol dashboard under API settings. Here's how to add the token to the request header using cURL:

Example request with bearer token

curl https://docs.meveth.org/v1/conversations \
  -H "Authorization: Bearer {token}"

Always keep your token safe and reset it if you suspect it has been compromised.

Protocol SDKs

The recommended way to interact with the Protocol API is by using one of our official SDKs. Today, Protocol offers fine-tuned JavaScript, Ruby, Solidity, Python, and Go libraries to make your life easier and give you the best experience when consuming the API.

Official libraries

Solidity

Solidity is an object-oriented, high-level language for implementing smart contracts.

Read more

Ruby

A dynamic, open source programming language with a focus on simplicity and productivity.

Read more

Node.js

Node.js® is an open-source, cross-platform JavaScript runtime environment.

Read more

Python

Python is a programming language that lets you work quickly and integrate systems more effectively.

Read more

Go

An open-source programming language supported by Google with built-in concurrency.

Read more

Using an SDK

If you use one of our official SDKs, you won't have to worry about any of the above — fetch your access token from the Protocol dashboard under API settings, and the client library will take care of the rest. All the client libraries use OAuth2 behind the scenes.

Choose your client

Before making your first API request, you need to pick which API client you will use. In addition to good ol' cURL HTTP requests, Protocol offers clients for JavaScript, Python, and Solidity. In the following example, you can see how to install each client.

# cURL is most likely already installed on your machine
curl --version

Making your first API request

After picking your preferred client, you are ready to make your first call to the Protocol API. Below, you can see how to send a GET request to the Conversations endpoint to get a list of all your conversations. In the cURL example, results are limited to ten conversations, the default page length for each client.

GET
/v1/conversations
curl -G https://docs.meveth.org/v1/conversations \
  -H "Authorization: Bearer {token}" \
  -d limit=10

Was this page helpful?