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.
Base URL
https://api.kubiya.ai/api/v1/sources
All endpoints require authentication with a valid API key.
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" : {
"code" : "string" ,
"message" : "string" ,
"details" : {}
}
}
Source Object
Source Object
Source with Metadata
{
"id" : "source-123" ,
"name" : "AWS Tools" ,
"type" : "git" ,
"url" : "https://github.com/org/aws-tools" ,
"branch" : "main" ,
"status" : "active" ,
"created_at" : "2023-01-01T00:00:00Z" ,
"updated_at" : "2023-01-15T12:00:00Z" ,
"metadata" : {
"description" : "Collection of AWS automation tools" ,
"tags" : [ "aws" , "automation" ],
"version" : "1.0.0"
}
}
List All Sources
Retrieve all sources in your organization.
Query Parameters
Maximum number of sources to return
Page number for pagination
Example Requests
List All Sources
Filter by Type
curl -X GET "https://api.kubiya.ai/api/v1/sources" \
-H "Authorization: UserKey $KUBIYA_API_KEY "
Response
[
{
"id" : "source-123" ,
"name" : "AWS Tools" ,
"type" : "git" ,
"url" : "https://github.com/org/aws-tools" ,
"branch" : "main" ,
"status" : "active" ,
"created_at" : "2023-01-01T00:00:00Z" ,
"updated_at" : "2023-01-15T12:00:00Z" ,
"metadata" : {
"description" : "Collection of AWS automation tools" ,
"tags" : [ "aws" , "automation" ],
"version" : "1.0.0"
}
}
]
Get Source by ID
Retrieve details for a specific source.
GET /api/v1/sources/{sourceId}
Path Parameters
ID of the source to retrieve
Example Requests
Get Source Details
Get Source Name
curl -X GET "https://api.kubiya.ai/api/v1/sources/source-123" \
-H "Authorization: UserKey $KUBIYA_API_KEY "
Response
{
"id" : "source-123" ,
"name" : "AWS Tools" ,
"type" : "git" ,
"url" : "https://github.com/org/aws-tools" ,
"branch" : "main" ,
"status" : "active" ,
"created_at" : "2023-01-01T00:00:00Z" ,
"updated_at" : "2023-01-15T12:00:00Z" ,
"metadata" : {
"description" : "Collection of AWS automation tools" ,
"tags" : [ "aws" , "automation" ],
"version" : "1.0.0"
}
}
Retrieve metadata for a specific source.
GET /api/v1/sources/{sourceId}/metadata
Path Parameters
Example Request
curl -X GET "https://api.kubiya.ai/api/v1/sources/source-123/metadata" \
-H "Authorization: UserKey $KUBIYA_API_KEY "
Response
{
"id" : "source-123" ,
"metadata" : {
"description" : "Collection of AWS automation tools" ,
"tags" : [ "aws" , "automation" ],
"version" : "1.0.0" ,
"last_sync" : "2023-01-15T12:00:00Z" ,
"tools_count" : 15 ,
"dependencies" : {
"python" : ">=3.8" ,
"aws-cli" : ">=2.0"
}
}
}
Discover/Load a Source
Discover and load a source from a URL.
GET /api/v1/sources/load?url={source_url}
Query Parameters
URL of the source to load
Branch to load (for Git sources)
Source type (git, zip, local)
Example Requests
Load Git Source
Load with Type
curl -X GET "https://api.kubiya.ai/api/v1/sources/load?url=https://github.com/org/tools&branch=main" \
-H "Authorization: UserKey $KUBIYA_API_KEY "
Response
{
"id" : "source-123" ,
"name" : "AWS Tools" ,
"type" : "git" ,
"url" : "https://github.com/org/aws-tools" ,
"branch" : "main" ,
"status" : "active" ,
"created_at" : "2023-01-01T00:00:00Z" ,
"updated_at" : "2023-01-15T12:00:00Z" ,
"metadata" : {
"description" : "Collection of AWS automation tools" ,
"tags" : [ "aws" , "automation" ],
"version" : "1.0.0"
}
}
Create a Source
Create a new source.
Request Body
Type of source (git, zip, local)
URL of the source (for git and zip types)
Branch name (for git sources)
Additional metadata for the source
Example Requests
Create Git Source
Create with Response
curl -X POST "https://api.kubiya.ai/api/v1/sources" \
-H "Authorization: UserKey $KUBIYA_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"name": "AWS Tools",
"type": "git",
"url": "https://github.com/org/aws-tools",
"branch": "main",
"metadata": {
"description": "Collection of AWS automation tools",
"tags": ["aws", "automation"]
}
}'
Response
{
"id" : "source-123" ,
"name" : "AWS Tools" ,
"type" : "git" ,
"url" : "https://github.com/org/aws-tools" ,
"branch" : "main" ,
"status" : "active" ,
"created_at" : "2023-01-01T00:00:00Z" ,
"updated_at" : "2023-01-15T12:00:00Z" ,
"metadata" : {
"description" : "Collection of AWS automation tools" ,
"tags" : [ "aws" , "automation" ],
"version" : "1.0.0"
}
}
Sync a Source
Synchronize a source with its remote repository.
PUT /api/v1/sources/{sourceId}
Path Parameters
Request Body
Force sync even if there are conflicts
Example Requests
curl -X PUT "https://api.kubiya.ai/api/v1/sources/source-123" \
-H "Authorization: UserKey $KUBIYA_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"branch": "main",
"force": false
}'
Response
{
"id" : "source-123" ,
"name" : "AWS Tools" ,
"type" : "git" ,
"url" : "https://github.com/org/aws-tools" ,
"branch" : "main" ,
"status" : "active" ,
"created_at" : "2023-01-01T00:00:00Z" ,
"updated_at" : "2023-01-15T12:00:00Z" ,
"metadata" : {
"description" : "Collection of AWS automation tools" ,
"tags" : [ "aws" , "automation" ],
"version" : "1.0.0" ,
"last_sync" : "2023-01-15T12:00:00Z"
}
}
Delete a Source
Delete a source.
DELETE /api/v1/sources/{sourceId}
Path Parameters
ID of the source to delete
Example Requests
Delete Source
Delete with Confirmation
curl -X DELETE "https://api.kubiya.ai/api/v1/sources/source-123" \
-H "Authorization: UserKey $KUBIYA_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.
GET /api/v1/sources/agent_sources/{sourceId}
Path Parameters
Example Request
curl -X GET "https://api.kubiya.ai/api/v1/sources/agent_sources/agent-123" \
-H "Authorization: UserKey $KUBIYA_API_KEY "
Response
[
{
"id" : "source-123" ,
"name" : "AWS Tools" ,
"type" : "git" ,
"url" : "https://github.com/org/aws-tools" ,
"status" : "active" ,
"metadata" : {
"description" : "Collection of AWS automation tools" ,
"tags" : [ "aws" , "automation" ]
}
}
]
Zip Endpoints
Load a Zipped Source
Load a source from a zip file.
PUT /api/v1/sources/zip/load
Request Body
Zip file containing the source
Example Request
curl -X PUT "https://api.kubiya.ai/api/v1/sources/zip/load" \
-H "Authorization: UserKey $KUBIYA_API_KEY " \
-F "file=@tools.zip" \
-F "name=Local Tools" \
-F "metadata={ \" description \" : \" Local tools collection \" }"
Response
{
"id" : "source-123" ,
"name" : "Local Tools" ,
"type" : "zip" ,
"status" : "active" ,
"created_at" : "2023-01-01T00:00:00Z" ,
"updated_at" : "2023-01-15T12:00:00Z" ,
"metadata" : {
"description" : "Local tools collection" ,
"tags" : [ "local" , "tools" ]
}
}
Create a Zipped Source
Create a zip file from a source.
Request Body
Whether to include metadata in the zip
Example Request
curl -X PUT "https://api.kubiya.ai/api/v1/sources/zip" \
-H "Authorization: UserKey $KUBIYA_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"source_id": "source-123",
"include_metadata": true
}' -o source-backup.zip
Response
The response is a zip file containing the source.
Common Errors
Source Not Found
Invalid URL
Sync Failed
{
"error" : {
"code" : "not_found" ,
"message" : "Source not found" ,
"details" : {
"sourceId" : "source-invalid"
}
}
}
Error Status Codes
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 500 Internal Server Error - An unexpected error occurred on the server
Next Steps