Luna SaludAPI ReferenceLuna Salud

List services

GET/services

Lists the services in your organization, with the ID to pass as serviceId to GET /availability and POST /appointments. Pass staffId to list only the services that provider offers, and bookable=true to list only the services shown on your public booking page. Each service's duration, in minutes, is the length of its appointments. Each service also reports its price, how your booking page presents it to patients (price_display: SHOW the amount, FROM as a starting price, or ON_REQUEST without an amount), its currency and deposit (anticipo) settings, and what your public booking page charges when a patient books it: charge_at_booking is NONE, DEPOSIT or FULL, and amount_due_at_booking is that amount before any discount code.

Code samples

Node.js

const fetch = require('node-fetch');

async function callApi() {
  const apiKey = 'YOUR_API_KEY';
  const staffId = 'your-staffId';
  const bookable = 'your-bookable';
  const rowsPerPage = 'your-rowsPerPage';
  const page = 'your-page';

const queryString = new URLSearchParams({
    staffId: staffId,
    bookable: bookable,
    rowsPerPage: rowsPerPage,
    page: page
  }).toString();

  const url = `https://account.lunahealth.app/api/services` + (queryString ? `?${queryString}` : '');
  try {
    const response = await fetch(url, {
      method: 'GET',
      headers: {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
      }
    });
    
    if (!response.ok) {
      throw new Error(`API error: ${response.status}`);
    }
    
    const data = await response.json();
    console.log(data);
    return data;
  } catch (error) {
    console.error('Error calling API:', error);
    throw error;
  }
}

callApi();

Python

import requests

def call_api():
    api_key = 'YOUR_API_KEY'
    
    url = 'https://account.lunahealth.app/api/services'
    
    headers = {
        'Authorization': f'Bearer {api_key}',
        'Content-Type': 'application/json'
    }
    
    params = {
    'staffId': 'your-staffId',
    'bookable': 'your-bookable',
    'rowsPerPage': 'your-rowsPerPage',
    'page': 'your-page'
    }
    
    try:
        response = requests.get(
            url,
            headers=headers,
            params=params
        )
        response.raise_for_status()
        
        data = response.json()
        print(data)
        return data
    except requests.exceptions.RequestException as e:
        print(f'Error calling API: {e}')
        raise

call_api()

Parameters

NameInTypeRequiredDescription
staffIdquerystringNo—
bookablequerystringNo—
rowsPerPagequerynumberNo—
pagequerynumberNo—

Responses

StatusDescription
200Successful response
400Invalid input data
401Authorization not provided
403Insufficient access
404Not found
500Internal server error

200 — Successful response

Response fields

NameTypeRequiredDescription
itemsarray<object>Yes—
metaobjectYes—

Example response

{
  "items": [
    {
      "id": "string",
      "name": "string",
      "duration_minutes": 0,
      "bookable": true,
      "price": null,
      "price_display": "SHOW",
      "currency": "string",
      "deposit_enabled": true,
      "deposit_percentage": null,
      "charge_at_booking": "NONE",
      "amount_due_at_booking": 0
    }
  ],
  "meta": {
    "totalRowCount": 0,
    "page": 0,
    "rowsPerPage": 0
  }
}

400 — Invalid input data

Response fields

NameTypeRequiredDescription
messagestringYesThe error message
codestringYesThe error code
issuesarray<object>NoAn array of issues that were responsible for the error

Example response

{
  "code": "BAD_REQUEST",
  "message": "Invalid input data",
  "issues": []
}

401 — Authorization not provided

Response fields

NameTypeRequiredDescription
messagestringYesThe error message
codestringYesThe error code
issuesarray<object>NoAn array of issues that were responsible for the error

Example response

{
  "code": "UNAUTHORIZED",
  "message": "Authorization not provided",
  "issues": []
}

403 — Insufficient access

Response fields

NameTypeRequiredDescription
messagestringYesThe error message
codestringYesThe error code
issuesarray<object>NoAn array of issues that were responsible for the error

Example response

{
  "code": "FORBIDDEN",
  "message": "Insufficient access",
  "issues": []
}

404 — Not found

Response fields

NameTypeRequiredDescription
messagestringYesThe error message
codestringYesThe error code
issuesarray<object>NoAn array of issues that were responsible for the error

Example response

{
  "code": "NOT_FOUND",
  "message": "Not found",
  "issues": []
}

500 — Internal server error

Response fields

NameTypeRequiredDescription
messagestringYesThe error message
codestringYesThe error code
issuesarray<object>NoAn array of issues that were responsible for the error

Example response

{
  "code": "INTERNAL_SERVER_ERROR",
  "message": "Internal server error",
  "issues": []
}