Create an API Collection
Create a new API collection within an API service.
Body Parameters
Name of the API collection. Must be unique within the parent API service.
Fully qualified name of the parent APIService (e.g., sample_api_service).
Base URL for the API collection (e.g., https://petstore3.swagger.io/#/pet).
Human-readable display name for the API collection.
Description of the API collection in Markdown format.
Array of owner references (users or teams) to assign to the API collection. UUID of the owner entity.
Type of owner entity (e.g., user, team).
Name of the owner entity.
Fully qualified name of the domain to assign for governance purposes.
Array of classification tags to apply to the API collection. Fully qualified name of the tag.
Type of label (e.g., Manual, Derived, Propagated).
State of the tag (e.g., Suggested, Confirmed).
Custom property values defined by your organization’s metadata schema.
from metadata.sdk import configure
from metadata.sdk.entities import APICollections
from metadata.generated.schema.api.data.createAPICollection import CreateAPICollectionRequest
configure(
host = "https://your-company.getcollate.io/api" ,
jwt_token = "your-jwt-token"
)
request = CreateAPICollectionRequest(
name = "pet" ,
service = "sample_api_service" ,
endpointURL = "https://petstore3.swagger.io/#/pet" ,
description = "Pet-related API endpoints"
)
api_collection = APICollections.create(request)
print ( f "Created: { api_collection.fullyQualifiedName } " )
{
"id" : "0f7ee81c-8163-4097-8adb-45c3d6c7b14b" ,
"name" : "pet" ,
"fullyQualifiedName" : "sample_api_service.pet" ,
"version" : 0.1 ,
"updatedAt" : 1769982733673 ,
"updatedBy" : "admin" ,
"endpointURL" : "https://petstore3.swagger.io/#/pet" ,
"href" : "http://localhost:8585/api/v1/apiCollections/0f7ee81c-8163-4097-8adb-45c3d6c7b14b" ,
"owners" : [],
"tags" : [],
"service" : {
"id" : "58d413a8-abc3-4a6d-bd8a-13a0234b1ff8" ,
"type" : "apiService" ,
"name" : "sample_api_service" ,
"fullyQualifiedName" : "sample_api_service" ,
"deleted" : false
},
"serviceType" : "Rest" ,
"deleted" : false ,
"domains" : []
}
Returns
Returns the created API collection object with all specified properties and system-generated fields.
Response
Unique identifier for the API collection (UUID format).
Fully qualified name in format service.collectionName.
Human-readable display name.
Description of the API collection in Markdown format.
Base URL for the API collection.
Reference to the parent API service. Type of entity (always apiService).
Fully qualified name of the API service.
Type of API service (e.g., Rest).
List of owners assigned to the API collection. UUID of the owner entity.
Type of owner entity (e.g., user, team).
Name of the owner entity.
Domain assignments for governance.
Classification tags applied to the API collection. Fully qualified name of the tag.
Type of label (e.g., Manual, Derived, Propagated).
State of the tag (e.g., Suggested, Confirmed).
Custom property values defined by your organization’s metadata schema.
Version number for the entity (starts at 0.1).
Create or Update (PUT)
Use PUT /v1/apiCollections instead of POST to perform an upsert. If an API collection with the same fullyQualifiedName already exists, it will be updated; otherwise, a new API collection is created. The request body is the same as POST.
curl -X PUT "{base_url}/api/v1/apiCollections" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json" \
-d '{ ... same body as POST ... }'
PUT will not return a 409 conflict error if the entity already exists — it will update the existing entity instead.
Bulk Create or Update (PUT)
Use PUT /v1/apiCollections/bulk to create or update multiple API collections in a single request. The request body is an array of create request objects.
curl -X PUT "{base_url}/api/v1/apiCollections/bulk" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json" \
-d '[
{ "name": "pet", "service": "sample_api_service" },
{ "name": "store", "service": "sample_api_service" }
]'
Error Handling
Code Error Type Description 400BAD_REQUESTInvalid request body or missing required fields 401UNAUTHORIZEDInvalid or missing authentication token 403FORBIDDENUser lacks permission to create API collections 409ENTITY_ALREADY_EXISTSAPI collection with same name already exists in service (POST only)