This directory contains JSON Schema definitions for all AdCP (Advertising Context Protocol) objects and task request/response structures.
The schemas are organized to provide comprehensive validation for:
- Core Data Models: Fundamental objects used throughout the protocol
- Task Schemas: Request and response structures for each protocol task
- Enums: Standardized enumerated values
- Signal Protocol: Schemas specific to the signals extension
schemas/
├── v1/ # Version 1 schemas
│ ├── core/ # Core data models
│ │ ├── product.json
│ │ ├── media-buy.json
│ │ ├── package.json
│ │ ├── creative-asset.json
│ │ ├── targeting.json
│ │ ├── frequency-cap.json
│ │ ├── format.json
│ │ ├── outcome-measurement.json
│ │ ├── creative-policy.json
│ │ ├── error.json
│ │ └── response.json
│ ├── media-buy/ # Media buy task schemas
│ │ ├── get-products-request.json
│ │ ├── get-products-response.json
│ │ ├── create-media-buy-request.json
│ │ ├── create-media-buy-response.json
│ │ ├── add-creative-assets-request.json
│ │ ├── add-creative-assets-response.json
│ │ ├── update-media-buy-request.json
│ │ ├── update-media-buy-response.json
│ │ ├── get-media-buy-delivery-request.json
│ │ ├── get-media-buy-delivery-response.json
│ │ ├── list-creative-formats-request.json
│ │ └── list-creative-formats-response.json
│ ├── signals/ # Signals protocol schemas
│ │ ├── get-signals-request.json
│ │ ├── get-signals-response.json
│ │ ├── activate-signal-request.json
│ │ └── activate-signal-response.json
│ ├── enums/ # Enum definitions
│ │ ├── delivery-type.json
│ │ ├── media-buy-status.json
│ │ ├── creative-status.json
│ │ ├── package-status.json
│ │ ├── pacing.json
│ │ └── frequency-cap-scope.json
│ └── index.json # Schema registry
├── asset-types-v1.json # Creative asset types (existing)
└── README.md # This file
When running the Docusaurus development server locally (npm run start), all schemas are accessible at:
- Schema Registry:
http://localhost:3000/schemas/latest/index.json - Core Schemas:
http://localhost:3000/schemas/latest/core/{schema-name}.json - Task Schemas:
http://localhost:3000/schemas/latest/media-buy/{task-name}-{request|response}.json - Signals Schemas:
http://localhost:3000/schemas/latest/signals/{task-name}-{request|response}.json - Enum Schemas:
http://localhost:3000/schemas/latest/enums/{enum-name}.json
The v1/index.json file serves as the main registry for all schemas, providing:
- Schema URLs and references
- Descriptions for each schema
- Usage examples
- Categorization by protocol area
const Ajv = require('ajv');
const ajv = new Ajv();
// Load and validate a product
const productSchema = require('./schemas/latest/core/product.json');
const validateProduct = ajv.compile(productSchema);
const product = {
"product_id": "ctv_sports_premium",
"name": "CTV Sports Premium",
"description": "Premium CTV inventory on sports content",
"format_ids": ["video_16x9_30s"],
"delivery_type": "guaranteed",
"is_fixed_price": true
};
const isValid = validateProduct(product);
if (!isValid) {
console.log(validateProduct.errors);
}import jsonschema
import json
# Load schema
with open('schemas/latest/core/product.json') as f:
schema = json.load(f)
# Validate data
product = {
"product_id": "ctv_sports_premium",
"name": "CTV Sports Premium",
"description": "Premium CTV inventory on sports content",
"format_ids": ["video_16x9_30s"],
"delivery_type": "guaranteed",
"is_fixed_price": True
}
try:
jsonschema.validate(product, schema)
print("Valid!")
except jsonschema.ValidationError as e:
print(f"Validation error: {e.message}")import com.github.fge.jsonschema.main.JsonSchema;
import com.github.fge.jsonschema.main.JsonSchemaFactory;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
// Load schema
ObjectMapper mapper = new ObjectMapper();
JsonNode schemaNode = mapper.readTree(new File("schemas/latest/core/product.json"));
JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
JsonSchema schema = factory.getJsonSchema(schemaNode);
// Validate data
JsonNode data = mapper.readTree(jsonString);
ProcessingReport report = schema.validate(data);All schemas follow these conventions:
All schemas use JSON Schema Draft 07 specification.
Each schema has a unique $id following the pattern:
https://adcp.dev/schemas/latest/{category}/{name}.json
Schemas reference each other using $ref to maintain consistency and avoid duplication.
All properties include comprehensive descriptions explaining their purpose and usage.
- String patterns for IDs and codes
- Minimum/maximum constraints for numeric values
- Required field specifications
- Additional property restrictions
All media buy tasks are covered with complete request/response schemas:
get_products- Product discoverylist_creative_formats- Format discoverycreate_media_buy- Campaign creationsync_creatives- Creative upload and managementupdate_media_buy- Campaign updatesget_media_buy_delivery- Performance reporting
Signal-related tasks have dedicated schemas:
get_signals- Signal discoveryactivate_signal- Signal activation
All fundamental protocol objects are defined:
- Products, Media Buys, Packages
- Creative Assets and Formats
- Targeting and Budget structures
- Measurement and Policy objects
Schemas are versioned using semantic versioning in the directory structure:
latest/- Current schemas{version}/- Pinned release versions (e.g.,3.0.0/)
Major version changes indicate breaking changes to the schema structure.
Use these schemas to generate strongly-typed client libraries in various languages:
- OpenAPI Generator
- quicktype
- Language-specific code generation tools
Reference schemas in API documentation to provide:
- Interactive validation
- Type information
- Field descriptions
- Example data structures
Use schemas to validate:
- API test fixtures
- Example data in documentation
- Integration test payloads
- Mock data generation
The schema implementation includes comprehensive testing to ensure accuracy and consistency:
# Test all schemas are syntactically valid
npm run test:schemas
# Individual schema validation
node tests/schema-validation.test.jsThis validates:
- All 36 schemas are syntactically correct JSON Schema Draft-07
- Cross-references (
$ref) resolve properly - Schema registry is consistent with actual files
- Required fields and constraints are properly defined
# Test example data against schemas
npm run test:examples
# Individual example validation
node tests/example-validation-simple.test.jsThis validates:
- Example data from documentation matches schemas
- Request/response structures are correctly defined
- Core data models validate properly
# Run all tests including TypeScript checks
npm testA pre-commit hook automatically ensures schema integrity on every commit:
# Pre-commit hook runs automatically, or test manually via:
npm run precommitThis runs:
- Schema validation tests (6 tests)
- Example data validation tests (7 tests)
- TypeScript type checking
# Start development server
npm run start
# Visit schema URLs in browser:
# http://localhost:3000/schemas/latest/index.json
# http://localhost:3000/schemas/latest/core/product.json
# etc.# Online JSON Schema validators:
# - https://www.jsonschemavalidator.net/
# - https://jsonschemalint.com/
# Load schema from local server when testingCommon issues and solutions:
Error: can't resolve reference /schemas/latest/enums/pacing.json
Solution: Ensure all referenced schemas exist and paths are correct.
Error: schema with key or id already exists
Solution: Check for duplicate $id values across schemas.
Schema validation failed for: {data}
Solution: Compare data structure against schema requirements, check required fields.
When updating schemas:
- Follow existing naming conventions
- Maintain backward compatibility within major versions
- Update the schema registry (
index.json) - Run all tests before committing:
npm test - Update documentation to match schema changes
- Add validation examples for new schemas
- Test locally by starting dev server and accessing schema URLs
CRITICAL: Documentation and JSON schemas MUST always be synchronized.
When making changes:
- ✅ Update documentation first
- ✅ Update corresponding schemas
- ✅ Run validation tests
- ✅ Test example data
- ✅ Update schema registry if needed
- ✅ Run pre-commit checks
For questions about the schemas or validation issues:
- Check the AdCP documentation
- Review the schema registry for available schemas
- Validate your data structure against the appropriate schema