# Merchants

## get_merchants

`TOOL get_merchants`

Get list of merchants for the authenticated user's organization

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

- `page` (optional)
  Type: number
  
  Page number for pagination
  
  default: 1

- `limit` (optional)
  Type: number
  
  Number of items per page
  
  default: 10

- `search` (optional)
  Type: string
  
  Search term for merchant name, code, or email

- `relations` (optional)
  Type: array
  
  Relations to include (e.g., ["contact", "tags"])
  
  Items:
    Type: string

- `where` (optional)
  Type: object
  
  Additional filters
  
  - `isActive` (optional)
    Type: boolean
  
  - `isArchived` (optional)
    Type: boolean

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_merchants",
    "arguments": {
        "page": 1,
        "limit": 10,
        "search": "string",
        "relations": [
          "string"
        ],
        "where": {
          "isActive": true,
          "isArchived": true
        }
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "get_merchants",
  "arguments": {
    "page": 1,
    "limit": 10,
    "search": "string",
    "relations": [
      "string"
    ],
    "where": {
      "isActive": true,
      "isArchived": true
    }
  }
});
```

### Python

```python
result = await session.call_tool("get_merchants", arguments={
  "page": 1,
  "limit": 10,
  "search": "string",
  "relations": [
    "string"
  ],
  "where": {
    "isActive": true,
    "isArchived": true
  }
})
```


## get_merchant_count

`TOOL get_merchant_count`

Get merchant count in the authenticated user's organization

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

- `where` (optional)
  Type: object
  
  Additional filters
  
  - `isActive` (optional)
    Type: boolean
  
  - `isArchived` (optional)
    Type: boolean

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_merchant_count",
    "arguments": {
        "where": {
          "isActive": true,
          "isArchived": true
        }
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "get_merchant_count",
  "arguments": {
    "where": {
      "isActive": true,
      "isArchived": true
    }
  }
});
```

### Python

```python
result = await session.call_tool("get_merchant_count", arguments={
  "where": {
    "isActive": true,
    "isArchived": true
  }
})
```


## get_merchant

`TOOL get_merchant`

Get a specific merchant by ID

Authentication: no security requirement declared for this operation.

Parameters:

- `id` (argument, string, uuid, required) - The merchant ID
  Type: string, uuid
  
  The merchant ID
  
  pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"

- `relations` (argument, array, optional) - Relations to include (e.g., ["contact", "tags"])
  Type: array
  
  Relations to include (e.g., ["contact", "tags"])
  
  Items:
    Type: string

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_merchant",
    "arguments": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "relations": [
          "string"
        ]
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "get_merchant",
  "arguments": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "relations": [
      "string"
    ]
  }
});
```

### Python

```python
result = await session.call_tool("get_merchant", arguments={
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "relations": [
    "string"
  ]
})
```


## create_merchant

`TOOL create_merchant`

Create a new merchant in the authenticated user's organization

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

- `merchant_data` (required)
  Type: object
  
  The data for creating the merchant
  
  - `name` (required)
    Type: string
    
    The name (required)
  
  Additional properties: 
    Type: unknown

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "create_merchant",
    "arguments": {
        "merchant_data": {
          "name": "string"
        }
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "create_merchant",
  "arguments": {
    "merchant_data": {
      "name": "string"
    }
  }
});
```

### Python

```python
result = await session.call_tool("create_merchant", arguments={
  "merchant_data": {
    "name": "string"
  }
})
```


## update_merchant

`TOOL update_merchant`

Update an existing merchant

Authentication: no security requirement declared for this operation.

Parameters:

- `id` (argument, string, uuid, required) - The merchant ID
  Type: string, uuid
  
  The merchant ID
  
  pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"

- `merchant_data` (argument, object, required) - The data for updating the merchant
  Type: object
  
  The data for updating the merchant
  
  Additional properties: 
    Type: unknown

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "update_merchant",
    "arguments": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "merchant_data": {}
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "update_merchant",
  "arguments": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "merchant_data": {}
  }
});
```

### Python

```python
result = await session.call_tool("update_merchant", arguments={
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "merchant_data": {}
})
```


## delete_merchant

`TOOL delete_merchant`

Delete a merchant

Authentication: no security requirement declared for this operation.

Parameters:

- `id` (argument, string, uuid, required) - The merchant ID
  Type: string, uuid
  
  The merchant ID
  
  pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "delete_merchant",
    "arguments": {
        "id": "550e8400-e29b-41d4-a716-446655440000"
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "delete_merchant",
  "arguments": {
    "id": "550e8400-e29b-41d4-a716-446655440000"
  }
});
```

### Python

```python
result = await session.call_tool("delete_merchant", arguments={
  "id": "550e8400-e29b-41d4-a716-446655440000"
})
```


## archive_merchant

`TOOL archive_merchant`

Archive a merchant (soft delete)

Authentication: no security requirement declared for this operation.

Parameters:

- `id` (argument, string, uuid, required) - The merchant ID
  Type: string, uuid
  
  The merchant ID
  
  pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "archive_merchant",
    "arguments": {
        "id": "550e8400-e29b-41d4-a716-446655440000"
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "archive_merchant",
  "arguments": {
    "id": "550e8400-e29b-41d4-a716-446655440000"
  }
});
```

### Python

```python
result = await session.call_tool("archive_merchant", arguments={
  "id": "550e8400-e29b-41d4-a716-446655440000"
})
```


## restore_merchant

`TOOL restore_merchant`

Restore an archived merchant

Authentication: no security requirement declared for this operation.

Parameters:

- `id` (argument, string, uuid, required) - The merchant ID
  Type: string, uuid
  
  The merchant ID
  
  pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "restore_merchant",
    "arguments": {
        "id": "550e8400-e29b-41d4-a716-446655440000"
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "restore_merchant",
  "arguments": {
    "id": "550e8400-e29b-41d4-a716-446655440000"
  }
});
```

### Python

```python
result = await session.call_tool("restore_merchant", arguments={
  "id": "550e8400-e29b-41d4-a716-446655440000"
})
```


## get_merchant_by_code

`TOOL get_merchant_by_code`

Get a merchant by its unique code

Authentication: no security requirement declared for this operation.

Parameters:

- `code` (argument, string, required) - The merchant code
  Type: string
  
  The merchant code

- `relations` (argument, array, optional) - Relations to include
  Type: array
  
  Relations to include
  
  Items:
    Type: string

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_merchant_by_code",
    "arguments": {
        "code": "string",
        "relations": [
          "string"
        ]
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "get_merchant_by_code",
  "arguments": {
    "code": "string",
    "relations": [
      "string"
    ]
  }
});
```

### Python

```python
result = await session.call_tool("get_merchant_by_code", arguments={
  "code": "string",
  "relations": [
    "string"
  ]
})
```


## search_merchants

`TOOL search_merchants`

Search merchants by name, code, email, or description

Authentication: no security requirement declared for this operation.

Parameters:

- `query` (argument, string, required) - Search query
  Type: string
  
  Search query

- `limit` (argument, number, optional) - Maximum number of results
  Type: number
  
  Maximum number of results
  
  default: 20

- `includeArchived` (argument, boolean, optional) - Include archived merchants in search
  Type: boolean
  
  Include archived merchants in search
  
  default: false

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "search_merchants",
    "arguments": {
        "query": "string",
        "limit": 20,
        "includeArchived": false
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "search_merchants",
  "arguments": {
    "query": "string",
    "limit": 20,
    "includeArchived": false
  }
});
```

### Python

```python
result = await session.call_tool("search_merchants", arguments={
  "query": "string",
  "limit": 20,
  "includeArchived": false
})
```


## get_merchant_statistics

`TOOL get_merchant_statistics`

Get merchant statistics for the authenticated user's organization

Authentication: no security requirement declared for this operation.

Parameters:

- `startDate` (argument, string, optional) - Start date for statistics (ISO format)
  Type: string
  
  Start date for statistics (ISO format)

- `endDate` (argument, string, optional) - End date for statistics (ISO format)
  Type: string
  
  End date for statistics (ISO format)

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_merchant_statistics",
    "arguments": {
        "startDate": "string",
        "endDate": "string"
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "get_merchant_statistics",
  "arguments": {
    "startDate": "string",
    "endDate": "string"
  }
});
```

### Python

```python
result = await session.call_tool("get_merchant_statistics", arguments={
  "startDate": "string",
  "endDate": "string"
})
```


## bulk_create_merchants

`TOOL bulk_create_merchants`

Create multiple merchants in bulk for the authenticated user's organization

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

- `merchants` (required)
  Type: array
  
  Array of merchant data to create
  
  Items:
    Type: object
    
    Merchant data
    
    - `name` (required)
      Type: string
      
      The name (required)
    
    Additional properties: 
      Type: unknown

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "bulk_create_merchants",
    "arguments": {
        "merchants": [
          {
            "name": "string"
          }
        ]
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "bulk_create_merchants",
  "arguments": {
    "merchants": [
      {
        "name": "string"
      }
    ]
  }
});
```

### Python

```python
result = await session.call_tool("bulk_create_merchants", arguments={
  "merchants": [
    {
      "name": "string"
    }
  ]
})
```


## get_active_merchants

`TOOL get_active_merchants`

Get only active (non-archived) merchants for the authenticated user's organization

Authentication: no security requirement declared for this operation.

Parameters:

- `page` (argument, number, optional) - Page number for pagination
  Type: number
  
  Page number for pagination
  
  default: 1

- `limit` (argument, number, optional) - Number of items per page
  Type: number
  
  Number of items per page
  
  default: 10

- `search` (argument, string, optional) - Search term for merchant name, code, or email
  Type: string
  
  Search term for merchant name, code, or email

- `relations` (argument, array, optional) - Relations to include
  Type: array
  
  Relations to include
  
  Items:
    Type: string

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_active_merchants",
    "arguments": {
        "page": 1,
        "limit": 10,
        "search": "string",
        "relations": [
          "string"
        ]
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "get_active_merchants",
  "arguments": {
    "page": 1,
    "limit": 10,
    "search": "string",
    "relations": [
      "string"
    ]
  }
});
```

### Python

```python
result = await session.call_tool("get_active_merchants", arguments={
  "page": 1,
  "limit": 10,
  "search": "string",
  "relations": [
    "string"
  ]
})
```


## get_archived_merchants

`TOOL get_archived_merchants`

Get archived merchants for the authenticated user's organization

Authentication: no security requirement declared for this operation.

Parameters:

- `page` (argument, number, optional) - Page number for pagination
  Type: number
  
  Page number for pagination
  
  default: 1

- `limit` (argument, number, optional) - Number of items per page
  Type: number
  
  Number of items per page
  
  default: 10

- `search` (argument, string, optional) - Search term for merchant name, code, or email
  Type: string
  
  Search term for merchant name, code, or email

- `relations` (argument, array, optional) - Relations to include
  Type: array
  
  Relations to include
  
  Items:
    Type: string

## Examples

### JSON-RPC

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_archived_merchants",
    "arguments": {
        "page": 1,
        "limit": 10,
        "search": "string",
        "relations": [
          "string"
        ]
      }
  }
}
```

### TypeScript

```typescript
const result = await client.callTool({
  "name": "get_archived_merchants",
  "arguments": {
    "page": 1,
    "limit": 10,
    "search": "string",
    "relations": [
      "string"
    ]
  }
});
```

### Python

```python
result = await session.call_tool("get_archived_merchants", arguments={
  "page": 1,
  "limit": 10,
  "search": "string",
  "relations": [
    "string"
  ]
})
```
