Skip to main content

Vendors Resource

API methods for vendors operations.

Methods

create

Create Vendor Create a new vendor.

This endpoint creates a new vendor in the Credo AI vendor registry.

Method: POST Path: /vendors

# Create Vendor
from credoai.models import VendorCreate
data = VendorCreate(
# Add required fields here
)

response = client.vendors.create(
data=data,
)

Parameters

Request Body: VendorCreate

Responses

201 - Successful Response

422 - Validation Error


list

List Vendors List all vendors.

This endpoint retrieves all vendors with optional pagination. Returns a paginated response with items and pagination metadata.

Method: GET Path: /vendors

# List Vendors

response = client.vendors.list(
)

Parameters

Query Parameters:

ParameterTypeRequiredDescription
page_limitAny-
page_afterAny-

Responses

200 - Successful Response

422 - Validation Error


get

Get Vendor Get a vendor by ID.

This endpoint retrieves an existing vendor by its ID.

Method: GET Path: /vendors/{vendor_id}

# Get Vendor
vendor_id = "example" # Path parameter

response = client.vendors.get(
vendor_id=vendor_id,
)

Parameters

Path Parameters:

ParameterTypeRequiredDescription
vendor_idstr-

Responses

200 - Successful Response

422 - Validation Error


update

Update Vendor Update an existing vendor.

This endpoint updates an existing vendor with the provided data. Only the fields provided in the request will be updated.

Method: PATCH Path: /vendors/{vendor_id}

# Update Vendor
from credoai.models import VendorUpdate
vendor_id = "example" # Path parameter
data = VendorUpdate(
# Add required fields here
)

response = client.vendors.update(
vendor_id=vendor_id,
data=data,
)

Parameters

Path Parameters:

ParameterTypeRequiredDescription
vendor_idstr-

Request Body: VendorUpdate

Responses

200 - Successful Response

422 - Validation Error


delete

Delete Vendor Delete a vendor by ID.

This endpoint deletes an existing vendor by its ID.

Method: DELETE Path: /vendors/{vendor_id}

# Delete Vendor
vendor_id = "example" # Path parameter

response = client.vendors.delete(
vendor_id=vendor_id,
)

Parameters

Path Parameters:

ParameterTypeRequiredDescription
vendor_idstr-

Responses

204 - Successful Response

422 - Validation Error


Usage Examples

Here's a complete example using the create method:

import asyncio
from credoai import
from credoai.models import VendorCreate

async def main():
# Initialize client
client = (
base_url="https://api.credo.ai",
api_key="test_password-your-api-key"
)

try:
# Create Vendor
data = VendorCreate(
# Add required fields here
)

response = await client.vendors.create(data=data)
print(f"Success: {response}")

except Exception as e:
print(f"Error: {e}")

finally:
await client.close()

# Run the example
asyncio.run(main())

Error Handling

All methods in this resource can raise the following exceptions:

  • ValidationError - Invalid request data
  • APIError - Server-side errors
  • AuthenticationError - Invalid or missing API key
  • NotFoundError - Resource not found (404)
  • RateLimitError - Too many requests
from credoai.errors import APIError, ValidationError

try:
response = client.vendors.create()
except ValidationError as e:
print(f"Invalid request: {e}")
except APIError as e:
print(f"API error {e.status_code}: {e.message}")