Sources API
API endpoints for managing tool sources in the Kubiya platform
Sources API
Sources in Kubiya are collections of tools that can be attached to teammates. Sources can be Git repositories, directories, or other tool collections. The Sources API allows you to create, discover, synchronize, and manage sources.
Endpoints
Method | Path | Description |
---|---|---|
GET | /api/v1/sources | List all sources |
GET | /api/v1/sources/{sourceId} | Get source by ID |
GET | /api/v1/sources/{sourceId}/metadata | Get source metadata |
GET | /api/v1/sources/load | Discover/load a source (GET) |
POST | /api/v1/sources | Create a new source |
PUT | /api/v1/sources/{sourceId} | Sync a source |
DELETE | /api/v1/sources/{sourceId} | Delete a source |
GET | /api/v1/sources/agent_sources/{sourceId} | Get agent sources |
PUT | /api/v1/sources/zip/load | Load a zipped source |
PUT | /api/v1/sources/zip | Create a zipped source |
PUT | /api/v1/sources/zip/sync/{sourceId} | Sync a zipped source |
Common Response Status Codes
Status Code | Description |
---|---|
200 | Success |
400 | Bad Request - Invalid parameters or request body |
401 | Unauthorized - Invalid or missing API key |
403 | Forbidden - Insufficient permissions |
404 | Not Found - Resource doesn't exist |
500 | Internal Server Error |
Error Response Format
List All Sources
Retrieve all sources in your organization.
Query Parameters
Name | Type | Required | Description |
---|---|---|---|
type | string | No | Filter by source type |
status | string | No | Filter by source status |
limit | integer | No | Maximum number of sources to return (default: 50) |
page | integer | No | Page number for pagination |
Headers
Name | Required | Description |
---|---|---|
Authorization | Yes | UserKey YOUR_API_KEY |
Response
Get Source by ID
Retrieve details for a specific source.
Path Parameters
Name | Type | Required | Description |
---|---|---|---|
sourceId | string | Yes | ID of the source to retrieve |
Headers
Name | Required | Description |
---|---|---|
Authorization | Yes | UserKey YOUR_API_KEY |
Response
Get Source Metadata
Retrieve metadata for a specific source.
Path Parameters
Name | Type | Required | Description |
---|---|---|---|
sourceId | string | Yes | ID of the source |
Headers
Name | Required | Description |
---|---|---|
Authorization | Yes | UserKey YOUR_API_KEY |
Response
Discover/Load a Source
Discover and load a source from a URL.
Query Parameters
Name | Type | Required | Description |
---|---|---|---|
url | string | Yes | URL of the source to load |
branch | string | No | Branch to load (for Git sources) |
type | string | No | Source type (git, zip, local) |
Headers
Name | Required | Description |
---|---|---|
Authorization | Yes | UserKey YOUR_API_KEY |
Response
Create a Source
Create a new source.
Headers
Name | Required | Description |
---|---|---|
Authorization | Yes | UserKey YOUR_API_KEY |
Content-Type | Yes | application/json |
Request Body
Required Fields
name
: Name of the sourcetype
: Type of source (git, zip, local)url
: URL of the source (for git and zip types)
Response
Sync a Source
Synchronize a source with its remote repository.
Path Parameters
Name | Type | Required | Description |
---|---|---|---|
sourceId | string | Yes | ID of the source to sync |
Headers
Name | Required | Description |
---|---|---|
Authorization | Yes | UserKey YOUR_API_KEY |
Content-Type | Yes | application/json |
Request Body
Response
Delete a Source
Delete a source.
Path Parameters
Name | Type | Required | Description |
---|---|---|---|
sourceId | string | Yes | ID of the source to delete |
Headers
Name | Required | Description |
---|---|---|
Authorization | Yes | UserKey YOUR_API_KEY |
Response
A successful delete operation returns an HTTP 200 status with no response body.
Get Agent Sources
Retrieve sources associated with a specific agent.
Path Parameters
Name | Type | Required | Description |
---|---|---|---|
sourceId | string | Yes | ID of the agent |
Headers
Name | Required | Description |
---|---|---|
Authorization | Yes | UserKey YOUR_API_KEY |
Response
Zip Endpoints
Load a Zipped Source
Load a source from a zip file.
Headers
Name | Required | Description |
---|---|---|
Authorization | Yes | UserKey YOUR_API_KEY |
Content-Type | Yes | multipart/form-data |
Request Body
Name | Type | Required | Description |
---|---|---|---|
file | file | Yes | Zip file containing the source |
name | string | Yes | Name for the source |
metadata | object | No | Additional metadata |
Response
Create a Zipped Source
Create a zip file from a source.
Headers
Name | Required | Description |
---|---|---|
Authorization | Yes | UserKey YOUR_API_KEY |
Content-Type | Yes | application/json |
Request Body
Response
The response is a zip file containing the source.
Sync a Zipped Source
Synchronize a zipped source.
Path Parameters
Name | Type | Required | Description |
---|---|---|---|
sourceId | string | Yes | ID of the source to sync |
Headers
Name | Required | Description |
---|---|---|
Authorization | Yes | UserKey YOUR_API_KEY |
Content-Type | Yes | multipart/form-data |
Request Body
Name | Type | Required | Description |
---|---|---|---|
file | file | Yes | Updated zip file |
force | boolean | No | Force sync even if there are conflicts |
Response
Sources are essential for providing tools to your teammates. Make sure to keep them up to date and properly organized.
Example Usage
Common Errors
HTTP Status | Description |
---|---|
400 | Bad Request - Invalid request body or missing required fields |
401 | Unauthorized - API key is missing or invalid |
403 | Forbidden - The API key doesn't have permission to perform this action |
404 | Not Found - The specified source was not found |
409 | Conflict - A source with the same name already exists |
500 | Internal Server Error - An unexpected error occurred on the server |
Next Steps
After setting up sources, you can: