MENU navbar-image

Introduction

This documentation aims to provide all the information you need to work with our API.

<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile).
You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).</aside>

Authenticating requests

To access the API endpoints (except for the Generate Token endpoint), you must include a valid authentication token in the request headers. Here's how to authenticate your requests:

  1. First, obtain an authentication token by calling the Generate Token endpoint:

  2. Include the token in subsequent requests using the Bearer token format in your Authorization header:

All API endpoints (except Generate Token) require authentication. Requests without a valid token will receive a 401 Unauthorized response.

Authorization: Bearer <your-token>

Authentication

APIs for managing authentication tokens

Generate authentication token

This endpoint generates a new authentication token using your email.

Example request:
curl --request POST \
    "https://exam.cardinalalpha.com/api/generate-token" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"email\": \"candidate@example.com\"
}"
const url = new URL(
    "https://exam.cardinalalpha.com/api/generate-token"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "candidate@example.com"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Success with Valid Email):


{
    "message": "Token Generated",
    "token": "1|abcdef123456..."
}
 

Example response (200, Invalid Email):


{
    "message": "Invalid Email"
}
 

Request      

POST api/generate-token

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

email   string   

The email address of the candidate. Example: candidate@example.com

Fund Management

List all funds

This endpoint retrieves a collection of all funds in the system.

Example request:
curl --request GET \
    --get "https://exam.cardinalalpha.com/api/fund" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://exam.cardinalalpha.com/api/fund"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Success):


{
    "data": [
        {
            "id": 1,
            "name": "Growth Fund",
            "created_at": "2025-07-30T10:00:00.000000Z",
            "updated_at": "2025-07-30T10:00:00.000000Z"
        },
        {
            "id": 2,
            "name": "Income Fund",
            "created_at": "2025-07-30T10:00:00.000000Z",
            "updated_at": "2025-07-30T10:00:00.000000Z"
        }
    ]
}
 

Request      

GET api/fund

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Get a specific fund

This endpoint retrieves the details of a specific fund by its ID.

Example request:
curl --request GET \
    --get "https://exam.cardinalalpha.com/api/fund/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://exam.cardinalalpha.com/api/fund/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Success):


{
    "data": {
        "id": 1,
        "name": "Growth Fund",
        "created_at": "2025-07-30T10:00:00.000000Z",
        "updated_at": "2025-07-30T10:00:00.000000Z"
    }
}
 

Example response (404, Not Found):


{
    "message": "No query results for model [App\\Models\\Fund] 999"
}
 

Request      

GET api/fund/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   string   

The ID of the fund. Example: 1

Investment Management

List all investments

This endpoint retrieves a collection of all investments in the system.

Example request:
curl --request GET \
    --get "https://exam.cardinalalpha.com/api/investments" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://exam.cardinalalpha.com/api/investments"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Success):


{
    "data": [
        {
            "id": 1,
            "uid": "INV-001",
            "start_date": "2025-01-01",
            "capital_amount": 10000,
            "status": "active",
            "created_at": "2025-07-30T10:00:00.000000Z",
            "updated_at": "2025-07-30T10:00:00.000000Z",
            "fund": {
                "id": 1,
                "name": "Growth Fund",
                "created_at": "2025-07-30T10:00:00.000000Z",
                "updated_at": "2025-07-30T10:00:00.000000Z"
            },
            "investor": {
                "id": 1,
                "name": "John Doe",
                "email": "john@example.com",
                "contact_number": "123-456-7890",
                "created_at": "2025-07-30T10:00:00.000000Z",
                "updated_at": "2025-07-30T10:00:00.000000Z"
            }
        },
        {
            "id": 2,
            "uid": "INV-002",
            "start_date": "2025-02-01",
            "capital_amount": 20000,
            "status": "pending",
            "created_at": "2025-07-30T10:00:00.000000Z",
            "updated_at": "2025-07-30T10:00:00.000000Z",
            "fund": {
                "id": 2,
                "name": "Income Fund",
                "created_at": "2025-07-30T10:00:00.000000Z",
                "updated_at": "2025-07-30T10:00:00.000000Z"
            },
            "investor": {
                "id": 2,
                "name": "Jane Smith",
                "email": "jane@example.com",
                "contact_number": "987-654-3210",
                "created_at": "2025-07-30T10:00:00.000000Z",
                "updated_at": "2025-07-30T10:00:00.000000Z"
            }
        }
    ]
}
 

Request      

GET api/investments

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Get a specific investment

This endpoint retrieves the details of a specific investment by its ID.

Example request:
curl --request GET \
    --get "https://exam.cardinalalpha.com/api/investments/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://exam.cardinalalpha.com/api/investments/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Success):


{
    "data": {
        "id": 1,
        "uid": "INV-001",
        "start_date": "2025-01-01",
        "capital_amount": 10000,
        "status": "active",
        "created_at": "2025-07-30T10:00:00.000000Z",
        "updated_at": "2025-07-30T10:00:00.000000Z",
        "fund": {
            "id": 1,
            "name": "Growth Fund",
            "created_at": "2025-07-30T10:00:00.000000Z",
            "updated_at": "2025-07-30T10:00:00.000000Z"
        },
        "investor": {
            "id": 1,
            "name": "John Doe",
            "email": "john@example.com",
            "contact_number": "123-456-7890",
            "created_at": "2025-07-30T10:00:00.000000Z",
            "updated_at": "2025-07-30T10:00:00.000000Z"
        }
    }
}
 

Example response (404, Not Found):


{
    "message": "No query results for model [App\\Models\\Investment] 999"
}
 

Request      

GET api/investments/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   string   

The ID of the investment. Example: 1

Investor Management

This endpoint allows you to search for investors based on their name, email, or contact number.

Example request:
curl --request GET \
    --get "https://exam.cardinalalpha.com/api/investor/search" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"search_type\": \"name\",
    \"value\": \"John\"
}"
const url = new URL(
    "https://exam.cardinalalpha.com/api/investor/search"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "search_type": "name",
    "value": "John"
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Success):


{
    "data": [
        {
            "id": 1,
            "name": "John Doe",
            "email": "john@example.com",
            "contact_number": "123-456-7890"
        }
    ]
}
 

Example response (422, Validation Error):


{
    "message": "The given data was invalid.",
    "errors": {
        "search_type": [
            "The search type field is required and must be name, email, or contact_number."
        ],
        "value": [
            "The value field is required."
        ]
    }
}
 

List all investors

This endpoint retrieves a collection of all investors in the system.

Example request:
curl --request GET \
    --get "https://exam.cardinalalpha.com/api/investor" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://exam.cardinalalpha.com/api/investor"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Success):


{
    "data": [
        {
            "id": 1,
            "name": "John Doe",
            "email": "john@example.com",
            "contact_number": "123-456-7890"
        },
        {
            "id": 2,
            "name": "Jane Smith",
            "email": "jane@example.com",
            "contact_number": "098-765-4321"
        }
    ]
}
 

Request      

GET api/investor

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Create a new investor

This endpoint allows you to create a new investor record in the system.

Example request:
curl --request POST \
    "https://exam.cardinalalpha.com/api/investor" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"John Doe\",
    \"email\": \"john@example.com\",
    \"contact_number\": \"123-456-7890\"
}"
const url = new URL(
    "https://exam.cardinalalpha.com/api/investor"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "John Doe",
    "email": "john@example.com",
    "contact_number": "123-456-7890"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (201, Success):


{
    "data": {
        "id": 1,
        "name": "John Doe",
        "email": "john@example.com",
        "contact_number": "123-456-7890"
    }
}
 

Example response (422, Validation Error):


{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "The name field is required."
        ],
        "email": [
            "The email field is required."
        ],
        "contact_number": [
            "The contact number field is required."
        ]
    }
}
 

Request      

POST api/investor

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

name   string   

The name of the investor. Example: John Doe

email   string   

The email address of the investor. Must be a valid email format. Example: john@example.com

contact_number   string   

The contact number of the investor. Example: 123-456-7890

Get a specific investor

This endpoint retrieves the details of a specific investor by their ID.

Example request:
curl --request GET \
    --get "https://exam.cardinalalpha.com/api/investor/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://exam.cardinalalpha.com/api/investor/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200, Success):


{
    "data": {
        "id": 1,
        "name": "John Doe",
        "email": "john@example.com",
        "contact_number": "123-456-7890"
    }
}
 

Example response (404, Not Found):


{
    "message": "No query results for model [App\\Models\\Investor] 999"
}
 

Request      

GET api/investor/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   string   

The ID of the investor. Example: 1

Update an investor

This endpoint allows you to update the details of an existing investor.

Example request:
curl --request PUT \
    "https://exam.cardinalalpha.com/api/investor/1" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"John Doe\",
    \"email\": \"john@example.com\",
    \"contact_number\": \"123-456-7890\"
}"
const url = new URL(
    "https://exam.cardinalalpha.com/api/investor/1"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "John Doe",
    "email": "john@example.com",
    "contact_number": "123-456-7890"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200, Success):


{
    "data": {
        "id": 1,
        "name": "John Doe Updated",
        "email": "john.updated@example.com",
        "contact_number": "123-456-7890"
    }
}
 

Example response (404, Not Found):


{
    "message": "No query results for model [App\\Models\\Investor] 999"
}
 

Example response (422, Validation Error):


{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "The name field is required."
        ],
        "email": [
            "The email field is required."
        ],
        "contact_number": [
            "The contact number field is required."
        ]
    }
}
 

Request      

PUT api/investor/{id}

PATCH api/investor/{id}

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   string   

The ID of the investor. Example: 1

Body Parameters

name   string   

The name of the investor. Example: John Doe

email   string   

The email address of the investor. Must be a valid email format. Example: john@example.com

contact_number   string   

The contact number of the investor. Example: 123-456-7890