Oumla Docs
  • Quick start
  • Introduction
  • Security
  • Networks
  • Authentication
  • Use cases
  • SDK
    • Oumla client
    • Create a Profile
    • Getting Profiles
    • Generate a Wallet
    • Getting Wallets
    • Generate Addresses
    • Getting Addresses
    • Getting Transactions
    • Sending Transactions
    • SDK reference
  • API Reference
    • Organization routes
    • Profiles routes
    • Wallet routes
    • Addresses routes
    • Transactions routes
  • Types
  • FAQs
Powered by GitBook
On this page
  • Create a profile
  • This operation creates a profile
  • Get Profiles
  • This operation gets a profile
  1. API Reference

Profiles routes

PreviousOrganization routesNextWallet routes

Last updated 9 months ago

Profiles play a central role, acting as the core for wallets, addresses, and transactions. When integrating a user into your system for blockchain interaction, having a wallet is key.

Profiles establish a direct link between your system's users and their corresponding wallets in ours. Creating a profile involves sending the user type and a reference, such as a UUID or email. This reference is necessary for tasks like generating addresses and handling transactions.

Everything starts with creating profile

Here are routes for profile management.

Create a profile

This operation creates a profile

POST https://sandbox.oumla.com/api/v1/profiles

Headers

Name
Type
Description

x-api-key*

string

The API key generated from Oumla's dashboard

Request Body

Name
Type
Description

reference *

string

Any identifer for this user this could be the UUID for the user or profile

type*

ProfileType

One of the profile types. User | Department | Merchant

Sample code of the request:

async function createProfile(reference: string, type: string) {
  const apiKey = "Your API Key";
  const url = "https://sandbox.oumla.com/api/v1/profiles";

  const data = JSON.stringify({ reference, type });

  const response = await fetch(url, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "x-api-key": apiKey,
    },
    body: data,
  });

  const responseData = await response.json();
  console.log(responseData);
}

// Example usage
createProfile("dba1fea5-2004-4ea8-a06d-a7c7c5559b8f", "User");
import axios from "axios";

async function createProfile(reference: string, type: string) {
  const apiKey = "Your API Key";
  const url = "https://sandbox.oumla.com/api/v1/profiles";

  try {
    const response = await axios.post(url, {
      reference,
      type,
    }, {
      headers: {
        "x-api-key": apiKey,
        "Content-Type": "application/json",
      },
    });

    console.log(response.data);
  } catch (error) {
    console.error("Error:", error);
  }
}

// Example usage
createProfile("dba1fea5-2004-4ea8-a06d-a7c7c5559b8f", "User");
import requests
import json

url = "https://sandbox.oumla.com/api/v1/profiles"
api_key = "Your API Key"

data = {
    "reference": "dba1fea5-2004-4ea8-a06d-a7c7c5559b8f",
    "type": "User"
}

headers = {
    "Content-Type": "application/json",
    "x-api-key": api_key
}

response = requests.post(url, data=json.dumps(data), headers=headers)

if response.status_code == 201:
    print(response.json())
else:
    print("Error:", response.status_code, response.text)

The expected response:

{
    "message": "Profile created",
    "profile": {
        "reference": "dba1fea5-2004-4ea8-a06d-a7c7c5559b8f",
        "type": "User"
    }
}

Check the type it should only one of these profile types : User | Department | Merchant

response: {
    status: 400,
    statusText: 'Bad Request',
    // ...
},

The profile with this reference is already exists.

response: {
    status: 404,
    statusText: 'Not Found',
    // ...
},

Get Profiles

This operation gets a profile

GET https://sandbox.oumla.com/api/v1/profiles

Query Parameters (Optional)

Name
Type
Description

skip

number

to skip a certain number of rows

limit

number

to get a certain number of rows

Headers

Name
Type
Description

x-api-key*

string

The API key generated from Oumla's dashboard

Sample code of the request:

async function getProfiles() {
  const apiKey = "Your API Key";
  const url = "https://sandbox.oumla.com/api/v1/profiles";

  const response = await fetch(url, {
    method: "GET",
    headers: {
      "x-api-key": apiKey,
    },
  });

  if (!response.ok) {
    throw new Error(`Error fetching data: ${response.status}`);
  }

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

// Example usage
getProfiles();
import axios from "axios";

async function getProfiles() {
  const apiKey = "Your API Key";
  const url = "https://sandbox.oumla.com/api/v1/profiles";

  try {
    const response = await axios.get(url, {
      headers: {
        "x-api-key": apiKey,
      },
    });

    console.log(response.data);
  } catch (error) {
    console.error("Error:", error);
  }
}

// Example usage
getProfiles();
import requests

response = requests.get('https://sandbox.oumla.com/api/v1/profiles', headers={
    'x-api-key': 'Your API Key'
})

if response.status_code == 200:
    print(response.json())
else:
    print(response.text)

The expected response:

{
    profiles: [
        {
            createdAt: '2024-01-17T09:32:29.546Z',
            updated_at: '2024-01-17T09:32:29.546Z',
            organizationId: '89a695b9-4c5f-4130-8b56-aff8010f8103',
            type: 'User',
            label: null,
            reference: 'dba1fea5-2004-4ea8-a06d-a7c7c5559b8f',
            miniWallets: [Array],
            bitcoin_balance: [Object],
            addressesCount: 0
        },
     // and the other profiles ...
    ], 
    skip: 0,
    take: 10,
    totalElements: 1,
    totalPages: 1
}

Make sure that you created an API Key from our , to start creating a profile

dashboard
Everything starts with the profile