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

# Marketplaces

> Documentation for the Marketplaces API endpoints including retrieving and updating marketplace records.

## List Marketplaces

Retrieves a list of marketplaces.

### HTTP Request

`GET https://api.cdr.fyi/v1/marketplaces`

### Query Parameters

| Parameter        | Type   | Description                                              |
| ---------------- | ------ | -------------------------------------------------------- |
| entityFilterType | String | Filter by entity type (Supplier, Marketplace, Purchaser) |
| entityFilterId   | String | Filter by entity ID                                      |

### Custom Headers

* `x-page`: The page number (default is 1)
* `x-limit`: Number of items per page (max 100, default is 10)

## Example Request

```bash theme={null}
curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.cdr.fyi/marketplaces?entityFilterType=Marketplace&entityFilterId=123"
```

### Create or Update a Marketplace

This endpoint creates a new marketplace or updates an existing one by upserting based on the `marketplace_id`.

#### HTTP Request

`POST https://api.cdr.fyi/v1/marketplaces`

#### Request Headers

* **Authorization**: Bearer YOUR\_ACCESS\_TOKEN
* **Content-Type**: application/json

#### Request Body Parameters

| Parameter       | Type    | Description                           | Required |
| --------------- | ------- | ------------------------------------- | -------- |
| marketplace\_id | String  | Unique identifier for the marketplace | No       |
| name            | String  | Name of the marketplace               | Yes      |
| methods         | String  | Payment methods available             | No       |
| website         | String  | Website URL                           | No       |
| logo            | String  | Logo URL                              | No       |
| slug            | String  | URL slug                              | No       |
| tagline         | String  | Tagline                               | No       |
| description     | String  | Description (max 500 characters)      | No       |
| year\_founded   | Integer | Year founded                          | No       |
| geo\_city       | String  | Geographic city                       | No       |
| geo\_country    | String  | Geographic country                    | No       |
| twitter         | String  | Twitter handle                        | No       |
| is\_verified    | Boolean | Verification status                   | No       |

Example Request

```bash theme={null}
curl -X GET https://api.cdr.fyi/v1/marketplaces \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
     -H "Content-Type: application/json" 
```

Example Response

```json theme={null}
{
  "newMarketplace": {
    "marketplace_id": "mkt_sample",
    "name": "Sample Marketplace",
    "methods": "Credit Card",
    "website": "https://sample.com",
    "logo": "https://sample.com/logo.png",
    "slug": "sample-marketplace",
    "tagline": "The best marketplace",
    "description": "This is a sample marketplace",
    "year_founded": 2020,
    "geo_city": "San Francisco",
    "geo_country": "USA",
    "twitter": "@sample",
    "is_verified": true
  }
}
```

## Error Responses

If the request is not successful, you will receive a 400 Bad Request or 401 Unauthorized response along with an error message indicating the issue.
