# Submitting via API

## API Upload MSISDNs

### Prepare the List of Phone Numbers

Ensure the list of phone numbers is available and formatted correctly. The phone numbers must begin with the Philippines country code (63). Example format:

639170000001\
639170000002\
639170000003

### Hash the Phone Numbers Using SHA-512

Use a tool that supports the SHA-512 algorithm to hash the phone numbers.

The CSV file should contain only one column with the hashed values of the phone numbers.

### Authentication

Obtain a token via the [authentication](https://docs.lenderlink.ph/product-guides/api-integration-guides/authentication "mention") procedure.&#x20;

### Endpoint: Upload MSISDNs

This API allows users to upload a list of MSISDNs (phone numbers) associated with a contributor.

**URL:**

`POST https://sandbox-app.lenderlink.ph/api/mobile-phone/upload`

### Request Headers

| Key           | Value            |
| ------------- | ---------------- |
| Content-Type  | application/json |
| Accept        | application/json |
| Authorization | Bearer `<token>` |

### Request Body (JSON)

```json
{
    "msisdns": [
        "94706ae07de698ee06d7716782c22e7cff507bf0d23b388dcec77d9dec6bfff393d37c0cf811b44ba77ff54a89c089c9c26c8f62a015d9b3860bcb369339ace3",
        "9dd3bac56f710d0a01cdc9af9df5be40e64f3f40e9510978a1fc937f24a68c0564d46834f12c86135bdcb48a6bfd5d781205383041b6e4105a24a84d2aa85f9a",
        "2cb88faba90a250561e07c42a7f65d4e86a5f3baced2b962cdcc9f660d3bc976fd7dd70ae59fcf26ce51d58aa8e0a1b271abb11dd7a1dd1f2ecd75d40a18621b",
        "fc8652e8bb0bf66db7e8f6a196e953c47dbbcc696f85229168f5d817ec3f7a4fa078b4b79a0ec9e4f4ef2399ae9145a6c262ec9000486de7834eea8d6258e690",
        "69e28301b2234f4b9bbabe2097665e860f34df2cf02c3ad4a8d5ed4a326892d0360e26efc48ee3b4ca234efa06a8a40ac0768a952c298f24812299bc99b7a98c"
    ]
}
```

### Validation

* **msisdns**: Required, must be an array with a maximum of 10000 entries.
* **msisdns.\***: Each MSISDN must be a valid string with only low case letters and digits that should be 128 in total per string.

### Error Handling

If validation fails, the following type of response will be returned:

```json
{
    "message": "The given data was invalid.",
    "errors": {
        "msisdns": [
            "The msisdns field is required."
        ],
        "msisdns.*": [
            "Each msisdn must be a valid string."
        ]
    }
}
```

Status Code: `422 Unprocessable Entity`

### Server Error

If there’s an issue on the server (e.g., batch number generation fails),the response will be: :

```json
{
    "error": "Failed to store MSISDNs"
}
```

Status Code: `500 Internal Server Error`

### Example Curl Request

```bash
curl -X POST https://sandbox-app.lenderlink.ph/mobile-phone/upload \
-H "Content-Type: application/json" \
-d '{
    "msisdns": [
        "94706ae07de698ee06d7716782c22e7cff507bf0d23b388dcec77d9dec6bfff393d37c0cf811b44ba77ff54a89c089c9c26c8f62a015d9b3860bcb369339ace3",
        "9dd3bac56f710d0a01cdc9af9df5be40e64f3f40e9510978a1fc937f24a68c0564d46834f12c86135bdcb48a6bfd5d781205383041b6e4105a24a84d2aa85f9a",
        "2cb88faba90a250561e07c42a7f65d4e86a5f3baced2b962cdcc9f660d3bc976fd7dd70ae59fcf26ce51d58aa8e0a1b271abb11dd7a1dd1f2ecd75d40a18621b",
        "fc8652e8bb0bf66db7e8f6a196e953c47dbbcc696f85229168f5d817ec3f7a4fa078b4b79a0ec9e4f4ef2399ae9145a6c262ec9000486de7834eea8d6258e690",
        "69e28301b2234f4b9bbabe2097665e860f34df2cf02c3ad4a8d5ed4a326892d0360e26efc48ee3b4ca234efa06a8a40ac0768a952c298f24812299bc99b7a98c"
    ]
}'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lenderlink.ph/product-guides/submitting-phone-numbers/submitting-via-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
