# Overview

The **Customer API** is designed for external integrations with the PartsSource Marketplace Platform. It enables partners and customers to programmatically search the parts catalog, place orders, and manage user information within their authorized tenant.

## Base URL

```
https://api.partssource.com/customer
```

## Key Features

### Multi-Tenant Architecture

The Customer API enforces strict tenant isolation. Each request is scoped to your organization, ensuring you can only access data belonging to your authorized tenant. Attempts to access resources outside your tenant will return a `403 Forbidden` error.

### Available Resources

| Resource    | Description                                                                      |
| ----------- | -------------------------------------------------------------------------------- |
| **Catalog** | Search parts and retrieve detailed product information including pricing options |
| **Orders**  | Create new orders and retrieve order status and details                          |
| **Users**   | Look up user profiles and search users within your organization                  |

## Authentication

All API requests require a valid JWT Bearer token obtained via the OAuth 2.0 client credentials flow.

```bash
curl -X POST https://auth.partssource.com/oauth2/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials" \
  -d "client_id=YOUR_CLIENT_ID" \
  -d "client_secret=YOUR_CLIENT_SECRET"
```

Include the token and API key in all requests:

```bash
curl -X GET https://api.partssource.com/customer/users/lookup?userId=12345 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "x-api-key: YOUR_API_KEY"
```

For complete authentication details, see [Authentication Overview](https://docs.partssource.com/documentation/authentication/overview).

## Response Format

All responses follow a consistent wrapper format:

```json
{
  "success": true,
  "data": { ... },
  "errors": null,
  "correlationId": "abc123-def456",
  "timestamp": "2025-01-10T12:00:00Z"
}
```

| Field           | Description                                       |
| --------------- | ------------------------------------------------- |
| `success`       | Indicates if the request completed successfully   |
| `data`          | The response payload (varies by endpoint)         |
| `errors`        | Array of error messages if `success` is `false`   |
| `correlationId` | Unique identifier for request tracing and support |
| `timestamp`     | UTC timestamp of the response                     |

## Getting Started

1. **Request API credentials** - Contact PartsSource to obtain your client ID and secret
2. **Review authentication** - Understand the [OAuth 2.0 flow](https://docs.partssource.com/documentation/authentication/overview)
3. **Explore the API Reference** - Browse available endpoints and schemas below
4. **Test in your environment** - Start with catalog search before placing orders

## Support

For API support, contact <api-support@partssource.com>. Include the `correlationId` from error responses for faster troubleshooting.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.partssource.com/customer-api/getting-started/readme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
