Contacts

The Marsol API provides an endpoint for adding a contact to a specific phonebook. This endpoint allows you to manage and organize your contacts by associating them with particular phonebooks. By using this endpoint, you can easily add new contacts to your phonebooks, ensuring that your contact data is well-structured and accessible for use in your SMS and OTP services.

post
Authorizations
x-auth-tokenstringRequired
Path parameters
phonebookIdstringRequired
Body
phoneNumberstringRequired
namestringRequired
metaDataobjectRequired
Responses
post
/public/phonebooks/{phonebookId}/contacts
POST /public/phonebooks/{phonebookId}/contacts HTTP/1.1
Host: api.marsol.ly
x-auth-token: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 68

{
  "phoneNumber": "text",
  "name": "text",
  "metaData": {
    "^.{1,64}$": "text"
  }
}
201Success
{
  "id": "text",
  "name": "text",
  "phoneNumber": "text",
  "createdAt": "2025-12-06T03:38:08.544Z",
  "phoneBookId": "text",
  "metaData": {}
}

Endpoint: /public/phonebooks/{phonebookId}/contacts

Method: POST

This endpoint is used to add a new contact to a specified phonebook. The contact information includes the contact's name and phone number.

Request Parameters

  • phonebookId (string, path parameter): The unique identifier of the phonebook to which the contact will be added.

Request Body

The request body must contain the following fields:

  • name (string): The name of the contact.

  • phoneNumber (string): The phone number of the contact.

  • metaData (object, {key: value}): The contact may have more information like Home Address which can be included in the meta data, i.e. {"Address": "Zawiat al-mahjob"}.

Security

This endpoint requires authentication. Include the x-auth-token in the request headers to authenticate your request.

POST /public/phonebooks/{phonebookId}/contacts HTTP/1.1
Host: api.marsol.ly
x-auth-token: your_api_token_here
Content-Type: application/json

Response

The response will include the contact object that was created, containing:

  • id (string): The unique identifier of the contact.

  • name (string): The name of the contact.

  • phoneNumber (string): The phone number of the contact.

  • createdAt (string, date-time): The timestamp when the contact was created.

  • phoneBookId (string, date-time): The timestamp when the contact was last updated.

  • metaData (object, {key: value}): The contact may have more information like Home Address, it'll be viewed in the meta data like this: {"Address": "Zawiat al-mahjob"}.

{
  "id": "string",
  "name": "string",
  "phoneNumber": "string",
  "createdAt": "2024-08-08T13:01:00.806Z",
  "phoneBookId": "string",
  "metaData": {}
}

Last updated