---
title: "Search services"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.getarbol.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Search services

Path: Oficlinic API › Services

`POST /v1/oficlinic/services/search`

Search the e-Oficlinic services by text over the connection's local index of the provider's complete master catalog and its professionals' configured services (GRID_PROCEDIMIENTOS), read through the connection and published only when complete. Results rank by an exact provider id, code or CUPS code, then the text as a phrase of the name, every word (accents ignored, prefixes allowed), then words within a small spelling distance. excludeTerms and excludeServiceIds are hard exclusions applied before ranking: no excluded service ever comes back, related ones included. configuredOnly (true by default) keeps services configured for at least one active professional; false searches the whole master catalog, which is not coverage. includeRelated adds, below every direct match, services configured for active professionals whose specialty matches the text, marked related_specialty: it is not a claim of clinical equivalence. Nothing here is coverage, an authorization or an open slot. The first search of a connection starts building the index and answers INDEX_NOT_READY until it is complete; an older index keeps serving while a refresh builds. Pass pageInfo.nextCursor with the same filters for more. agentMode true answers concise Spanish text instead.

- **Scope:** `oficlinic:services:read`
- **Credentials:** an API key, a client-credentials token or a person's access token
- **Effect:** read-only; safe to retry
- **Limits:** request body up to 8 KB, response up to 64 KB
- **CLI:** `arbol oficlinic services search` · **MCP tool:** `oficlinic_services_search`

## Authentication

Requires one of the following:

- `arbolHuman`, oauth2, scopes: `oficlinic:services:read`
- `arbolMachine`, oauth2, scopes: `oficlinic:services:read`
- `arbolApiKey`, http, header `Authorization`

## Request body

_Required._

- `connectionId` (`oficlinic.services.search.connectionId`; string, optional) — An Account connection id of the caller's organization.
  - pattern `^con_[0-9A-Za-z]{26}$`
- `q` (`oficlinic.services.search.q`; string, optional) — Free text: a service name in Spanish, words of it, or a provider id, code or CUPS code. Without it, the filtered services are listed in the provider's order.
  - minLength 1; maxLength 200
- `excludeTerms` (`oficlinic.services.search.excludeTerms`; array<string>, optional) — Hard exclusions: a service whose name or CUPS description has a word starting with any of these terms (accents ignored) is never answered.
  - minLength 2; maxLength 60; default `[]`
- `excludeServiceIds` (`oficlinic.services.search.excludeServiceIds`; array<string>, optional) — Hard exclusions by service id.
  - pattern `^[0-9A-Za-z._-]{1,32}$`; default `[]`
- `active` (`oficlinic.services.search.active`; boolean, optional) — Only services whose master-catalog active flag is this value.
- `professionalId` (`oficlinic.services.search.professionalId`; string, optional) — Only services configured for this active professional (GRID_PROCEDIMIENTOS); PROFESSIONAL_NOT_FOUND when the index holds no such active professional.
  - pattern `^[0-9A-Za-z._-]{1,32}$`
- `specialty` (`oficlinic.services.search.specialty`; string, optional) — Only services configured for an active professional whose specialty contains these words (accents ignored).
  - minLength 2; maxLength 80
- `configuredOnly` (`oficlinic.services.search.configuredOnly`; boolean, optional) — true (the default) keeps services configured for at least one active professional; false searches the whole master catalog.
  - default `true`
- `includeRelated` (`oficlinic.services.search.includeRelated`; boolean, optional) — Also answer, below every direct match, services configured for active professionals whose specialty matches q, marked related_specialty. Not a claim of clinical equivalence.
  - default `false`
- `cursor` (`oficlinic.services.search.cursor`; string, optional) — An opaque cursor from a previous page's pageInfo.nextCursor or pageInfo.previousCursor.
  - minLength 4; maxLength 192; pattern `^[A-Za-z0-9_-]+$`
- `direction` (`oficlinic.services.search.direction`; string, optional) — Direction to traverse the stable keyset ordering from the supplied cursor.
  - one of `"forward"`, `"backward"`; default `"forward"`
- `limit` (`oficlinic.services.search.limit`; integer, optional) — Maximum items returned in one page. Defaults to 10; larger reads require another cursor.
  - min 1; max 50; default `10`
- `agentMode` (`oficlinic.services.search.agentMode`; boolean, optional) — true answers { text }: concise Spanish facts for a messaging or voice agent, with the short ids and the cursor needed to continue. false, the default, answers the structured object.
  - default `false`

## Example request

```json
{
  "connectionId": "string",
  "q": "string",
  "excludeTerms": [],
  "excludeServiceIds": [],
  "active": true,
  "professionalId": "string",
  "specialty": "string",
  "configuredOnly": true,
  "includeRelated": false,
  "cursor": "string",
  "direction": "forward",
  "limit": 10,
  "agentMode": false
}
```

## Code samples

### cURL

```bash
curl https://api.getarbol.com/v1/oficlinic/services/search \
  --request POST \
  --header "Authorization: Bearer $ARBOL_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{}'
```

### TypeScript

```typescript
import { createClient } from "@arbol-ai/sdk";

const arbol = createClient({
  baseUrl: "https://api.getarbol.com",
  token: process.env.ARBOL_API_KEY!,
});

const { data } = await arbol.oficlinic.services.search();
```

### Rust

```rust
use arbol_sdk::{types, Client, Credential};

let arbol = Client::new(Credential::ApiKey(std::env::var("ARBOL_API_KEY")?))?;

let data = arbol
    .oficlinic()
    .services()
    .search(&types::OficlinicServicesSearchInput::default())
    .await?;
```

### CLI

```bash
arbol oficlinic services search
```

### MCP

```json
{
  "name": "oficlinic_services_search",
  "arguments": {}
}
```

## Responses

### 200

Successful operation.

#### Example

```json
{
  "success": true,
  "data": {
    "data": [
      {
        "id": "string",
        "code": "string",
        "name": "string",
        "cupsCode": "string",
        "cupsDescription": "string",
        "specialPreparation": "string",
        "active": true,
        "studyType": "string",
        "configured": true,
        "professionalCount": 0,
        "match": "code",
        "relatedSpecialty": "string",
        "indexedAt": "2019-08-24T14:15:22Z"
      }
    ],
    "object": "list",
    "pageInfo": {
      "hasNextPage": true,
      "hasPreviousPage": true,
      "nextCursor": "string",
      "previousCursor": "string"
    }
  },
  "error": null,
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`oficlinic.services.search.response.200.success`; boolean, required)
  - one of `true`
- `data` (`oficlinic.services.search.response.200.data`; OficlinicSearchServicesResult, required)
  - any of: `OficlinicServiceSearchPage`, `OficlinicAgentText`
- `error` (`oficlinic.services.search.response.200.error`; unknown, required)
- `metadata` (`oficlinic.services.search.response.200.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`oficlinic.services.search.response.200.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 400

- `INVALID_INPUT`: The request does not match the published schema.
- `INVALID_CURSOR`: The cursor is invalid or belongs to another list.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "INVALID_INPUT",
    "message": "string",
    "retryable": false,
    "data": {
      "issues": [
        {
          "path": "string",
          "message": "string"
        }
      ]
    }
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`oficlinic.services.search.response.400.success`; boolean, required)
  - one of `false`
- `data` (`oficlinic.services.search.response.400.data`; unknown, required)
- `error` (`oficlinic.services.search.response.400.error`; OficlinicSearchServicesBadRequestFailure, required)
  - one of: `InvalidInputFailure`, `OficlinicInvalidCursorFailure`
  - discriminator: `code`
- `metadata` (`oficlinic.services.search.response.400.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`oficlinic.services.search.response.400.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 401

`UNAUTHORIZED`: A valid access token is required.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "string",
    "retryable": false,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`oficlinic.services.search.response.401.success`; boolean, required)
  - one of `false`
- `data` (`oficlinic.services.search.response.401.data`; unknown, required)
- `error` (`oficlinic.services.search.response.401.error`; object, required) — A valid access token is required.
  - `code` (`oficlinic.services.search.response.401.error.code`; string, required) — The failure code, stable across releases.
    - one of `"UNAUTHORIZED"`
  - `message` (`oficlinic.services.search.response.401.error.message`; string, required) — What went wrong, for people; it never contains input values.
  - `retryable` (`oficlinic.services.search.response.401.error.retryable`; boolean, required) — Whether repeating the same request may succeed.
    - one of `false`
  - `data` (`oficlinic.services.search.response.401.error.data`; object, required) — No fields.
- `metadata` (`oficlinic.services.search.response.401.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`oficlinic.services.search.response.401.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 403

`FORBIDDEN`: The token does not authorize this operation.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "FORBIDDEN",
    "message": "string",
    "retryable": false,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`oficlinic.services.search.response.403.success`; boolean, required)
  - one of `false`
- `data` (`oficlinic.services.search.response.403.data`; unknown, required)
- `error` (`oficlinic.services.search.response.403.error`; object, required) — The token does not authorize this operation.
  - `code` (`oficlinic.services.search.response.403.error.code`; string, required) — The failure code, stable across releases.
    - one of `"FORBIDDEN"`
  - `message` (`oficlinic.services.search.response.403.error.message`; string, required) — What went wrong, for people; it never contains input values.
  - `retryable` (`oficlinic.services.search.response.403.error.retryable`; boolean, required) — Whether repeating the same request may succeed.
    - one of `false`
  - `data` (`oficlinic.services.search.response.403.error.data`; object, required) — No fields.
- `metadata` (`oficlinic.services.search.response.403.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`oficlinic.services.search.response.403.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 404

- `CONNECTION_NOT_FOUND`: The connection does not exist in this organization.
- `PROFESSIONAL_NOT_FOUND`: The professional is not an active professional of the connection's indexed directory.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "CONNECTION_NOT_FOUND",
    "message": "string",
    "retryable": false,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`oficlinic.services.search.response.404.success`; boolean, required)
  - one of `false`
- `data` (`oficlinic.services.search.response.404.data`; unknown, required)
- `error` (`oficlinic.services.search.response.404.error`; OficlinicSearchServicesNotFoundFailure, required)
  - one of: `OficlinicConnectionNotFoundFailure`, `OficlinicProfessionalNotFoundFailure`
  - discriminator: `code`
- `metadata` (`oficlinic.services.search.response.404.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`oficlinic.services.search.response.404.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 409

- `CONNECTION_REQUIRED`: The organization has several active connections: select one.
- `CONNECTION_NOT_ACTIVE`: The connection is not active.
- `REAUTHENTICATION_REQUIRED`: Provider sign-in is stopped for this connection. Verify the connection again.
- `INDEX_UNAVAILABLE`: The connection's service index could not be built. Staff must check the connection and sync the catalog.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "CONNECTION_REQUIRED",
    "message": "string",
    "retryable": false,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`oficlinic.services.search.response.409.success`; boolean, required)
  - one of `false`
- `data` (`oficlinic.services.search.response.409.data`; unknown, required)
- `error` (`oficlinic.services.search.response.409.error`; OficlinicSearchServicesConflictFailure, required)
  - one of: `OficlinicConnectionRequiredFailure`, `OficlinicConnectionNotActiveFailure`, `OficlinicReauthenticationRequiredFailure`, `OficlinicIndexUnavailableFailure`
  - discriminator: `code`
- `metadata` (`oficlinic.services.search.response.409.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`oficlinic.services.search.response.409.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 413

`REQUEST_TOO_LARGE`: The request exceeds the allowed size.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "REQUEST_TOO_LARGE",
    "message": "string",
    "retryable": false,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`oficlinic.services.search.response.413.success`; boolean, required)
  - one of `false`
- `data` (`oficlinic.services.search.response.413.data`; unknown, required)
- `error` (`oficlinic.services.search.response.413.error`; object, required) — The request exceeds the allowed size.
  - `code` (`oficlinic.services.search.response.413.error.code`; string, required) — The failure code, stable across releases.
    - one of `"REQUEST_TOO_LARGE"`
  - `message` (`oficlinic.services.search.response.413.error.message`; string, required) — What went wrong, for people; it never contains input values.
  - `retryable` (`oficlinic.services.search.response.413.error.retryable`; boolean, required) — Whether repeating the same request may succeed.
    - one of `false`
  - `data` (`oficlinic.services.search.response.413.error.data`; object, required) — No fields.
- `metadata` (`oficlinic.services.search.response.413.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`oficlinic.services.search.response.413.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 415

`UNSUPPORTED_MEDIA_TYPE`: The request content type is not supported.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "UNSUPPORTED_MEDIA_TYPE",
    "message": "string",
    "retryable": false,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`oficlinic.services.search.response.415.success`; boolean, required)
  - one of `false`
- `data` (`oficlinic.services.search.response.415.data`; unknown, required)
- `error` (`oficlinic.services.search.response.415.error`; object, required) — The request content type is not supported.
  - `code` (`oficlinic.services.search.response.415.error.code`; string, required) — The failure code, stable across releases.
    - one of `"UNSUPPORTED_MEDIA_TYPE"`
  - `message` (`oficlinic.services.search.response.415.error.message`; string, required) — What went wrong, for people; it never contains input values.
  - `retryable` (`oficlinic.services.search.response.415.error.retryable`; boolean, required) — Whether repeating the same request may succeed.
    - one of `false`
  - `data` (`oficlinic.services.search.response.415.error.data`; object, required) — No fields.
- `metadata` (`oficlinic.services.search.response.415.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`oficlinic.services.search.response.415.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 429

`RATE_LIMITED`: The request rate limit was exceeded. Try again later.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "RATE_LIMITED",
    "message": "string",
    "retryable": true,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`oficlinic.services.search.response.429.success`; boolean, required)
  - one of `false`
- `data` (`oficlinic.services.search.response.429.data`; unknown, required)
- `error` (`oficlinic.services.search.response.429.error`; object, required) — The request rate limit was exceeded. Try again later.
  - `code` (`oficlinic.services.search.response.429.error.code`; string, required) — The failure code, stable across releases.
    - one of `"RATE_LIMITED"`
  - `message` (`oficlinic.services.search.response.429.error.message`; string, required) — What went wrong, for people; it never contains input values.
  - `retryable` (`oficlinic.services.search.response.429.error.retryable`; boolean, required) — Whether repeating the same request may succeed.
    - one of `true`
  - `data` (`oficlinic.services.search.response.429.error.data`; object, required) — No fields.
- `metadata` (`oficlinic.services.search.response.429.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`oficlinic.services.search.response.429.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 500

`INTERNAL_ERROR`: The service could not complete the operation.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "INTERNAL_ERROR",
    "message": "string",
    "retryable": false,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`oficlinic.services.search.response.500.success`; boolean, required)
  - one of `false`
- `data` (`oficlinic.services.search.response.500.data`; unknown, required)
- `error` (`oficlinic.services.search.response.500.error`; object, required) — The service could not complete the operation.
  - `code` (`oficlinic.services.search.response.500.error.code`; string, required) — The failure code, stable across releases.
    - one of `"INTERNAL_ERROR"`
  - `message` (`oficlinic.services.search.response.500.error.message`; string, required) — What went wrong, for people; it never contains input values.
  - `retryable` (`oficlinic.services.search.response.500.error.retryable`; boolean, required) — Whether repeating the same request may succeed.
    - one of `false`
  - `data` (`oficlinic.services.search.response.500.error.data`; object, required) — No fields.
- `metadata` (`oficlinic.services.search.response.500.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`oficlinic.services.search.response.500.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 502

- `OUTCOME_UNKNOWN`: The operation may have been applied; check its result before repeating it.
- `PROVIDER_PROTOCOL_CHANGED`: The provider returned an unrecognized response.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "OUTCOME_UNKNOWN",
    "message": "string",
    "retryable": false,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`oficlinic.services.search.response.502.success`; boolean, required)
  - one of `false`
- `data` (`oficlinic.services.search.response.502.data`; unknown, required)
- `error` (`oficlinic.services.search.response.502.error`; OficlinicSearchServicesBadGatewayFailure, required)
  - one of: `OutcomeUnknownFailure`, `ProviderProtocolChangedFailure`
  - discriminator: `code`
- `metadata` (`oficlinic.services.search.response.502.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`oficlinic.services.search.response.502.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 503

- `UPSTREAM_UNAVAILABLE`: The upstream service could not complete the request.
- `INDEX_NOT_READY`: The connection's service index is being built. Try again shortly.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "UPSTREAM_UNAVAILABLE",
    "message": "string",
    "retryable": true,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`oficlinic.services.search.response.503.success`; boolean, required)
  - one of `false`
- `data` (`oficlinic.services.search.response.503.data`; unknown, required)
- `error` (`oficlinic.services.search.response.503.error`; OficlinicSearchServicesServiceUnavailableFailure, required)
  - one of: `UpstreamUnavailableFailure`, `OficlinicIndexNotReadyFailure`
  - discriminator: `code`
- `metadata` (`oficlinic.services.search.response.503.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`oficlinic.services.search.response.503.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 504

`UPSTREAM_TIMEOUT`: The upstream service did not respond before its deadline.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "UPSTREAM_TIMEOUT",
    "message": "string",
    "retryable": true,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`oficlinic.services.search.response.504.success`; boolean, required)
  - one of `false`
- `data` (`oficlinic.services.search.response.504.data`; unknown, required)
- `error` (`oficlinic.services.search.response.504.error`; object, required) — The upstream service did not respond before its deadline.
  - `code` (`oficlinic.services.search.response.504.error.code`; string, required) — The failure code, stable across releases.
    - one of `"UPSTREAM_TIMEOUT"`
  - `message` (`oficlinic.services.search.response.504.error.message`; string, required) — What went wrong, for people; it never contains input values.
  - `retryable` (`oficlinic.services.search.response.504.error.retryable`; boolean, required) — Whether repeating the same request may succeed.
    - one of `true`
  - `data` (`oficlinic.services.search.response.504.error.data`; object, required) — No fields.
- `metadata` (`oficlinic.services.search.response.504.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`oficlinic.services.search.response.504.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.


Source: https://docs.getarbol.com/api/oficlinic/services/search/index.md
