This repository serves as the central hub for all ONDC (Open Network for Digital Commerce) specifications, organized using Git submodules for efficient management and version control.
The ONDC Specifications Hub consolidates all domain-specific specifications into a single, well-organized structure. Each specification domain is maintained as a separate repository and linked here as a Git submodule, allowing for independent versioning while maintaining a unified view.
ONDC-Specifications/
│── ONDC-Protocol-Specs/ # Core protocol specifications
│── ONDC-RET-Specifications/ # Retail domain specifications
│── ONDC-LOG-Specifications/ # Logistics domain specifications
│── ONDC-SRV-Specifications/ # Services domain specifications
│── ONDC-{DOMAIN}-Specifications/ # Other domain specifications
└── README.md # This file
To clone this repository along with all specification submodules:
git clone --recursive https://github.com/nmonga26/ONDC-Specifications.gitIf you've already cloned the repository without the --recursive flag:
git submodule init
git submodule updateOr in a single command:
git submodule update --init --recursiveTo update a specific specification submodule to its latest version:
# Navigate to the specific submodule
cd SPECIFICATIONS/ONDC-Protocol-Specs
# Pull the latest changes
git pull origin main
# Go back to the main repository
cd ../..
# Stage the submodule update
git add SPECIFICATIONS/ONDC-Protocol-Specs
# Commit the change
git commit -m "Update ONDC-Protocol-Specs to latest version"
# Push to remote
git pushTo update all submodules to their latest versions:
# Update all submodules to their latest remote versions
git submodule update --remote --merge
# Stage all changes
git add .
# Commit the updates
git commit -m "Update all specification submodules to latest versions"
# Push to remote
git pushTo see the current status of all submodules:
git submodule statusTo fetch the latest changes for all submodules without updating them:
git submodule foreach git fetch- ONDC-Protocol-Specs: Core ONDC protocol definitions, APIs, and standards
- ONDC-RET-Specifications: Retail and e-commerce domain specifications
- ONDC-LOG-Specifications: Logistics and delivery specifications
- ONDC-SRV-Specifications: Services domain specifications
This document establishes comprehensive guidelines for adding new specifications or updating existing specifications in the ONDC-Specifications repository. All contributors must follow these guidelines to maintain consistency, quality, and interoperability across all ONDC domains.
- Each domain MUST have its own submodule following the naming pattern:
ONDC-{DOMAIN}-Specifications - Examples:
ONDC-RET-Specifications,ONDC-LOG-Specifications,ONDC-SRV-Specifications
Every domain repository MUST follow this structure:
/ONDC-{DOMAIN}-Specifications
├── README.md
├── Usage.md
├── Contribution.md
├── Error-codes.xlsx
├── index.html
├── build_util
├── api/
│ ├── brd_images/
│ ├── build/
│ ├── components/
│ │ ├── Examples/
│ │ ├── attributes/
│ │ ├── enums/
│ │ ├── error_codes/
│ │ ├── flows/
│ │ ├── tags/
│ │ └── utils/
│ └── docs/
├── beckn-core/ (submodule)
├── ONDC-transaction-Specifications/ (submodule - REQUIRED)
└── ui/
All domain specification repositories MUST include:
- ONDC-transaction-specifications: ONDC Transaction Specifications (MANDATORY)
# When creating or updating a domain specification repository:
git submodule add https://github.com/nmonga26/ONDC-transaction-Specifications.git ONDC-transaction-Specifications- Use lowercase with underscores for file names:
service_name_action.yaml - API examples:
{service_type}_{action}.jsonor{service_type}_{action}.yaml - Flow diagrams:
{service_type}_flow_{scenario}.png - Documentation:
{feature}_specification.md
- API Specifications: YAML format (primary), JSON for examples
- Documentation: Markdown (.md)
- Diagrams: PNG or SVG
- Error Codes: Excel (.xlsx) at root, YAML in components
When adding a new service or feature, include:
- API specification files in
/api/components/ - Examples in both JSON and YAML formats
- Flow diagrams in
/api/brd_images/ - Attribute definitions in
/api/components/attributes/ - Enum definitions if applicable
- Updated error codes
- Documentation in
/api/docs/
Each API endpoint MUST have:
- Request example:
{action}_request.json - Response example:
on_{action}_response.json - Error scenarios:
{action}_error_scenarios.yaml
Every specification file MUST include:
openapi: 3.0.0
info:
title: ONDC {Domain} API
version: "draft-2.x.x"
description: |
Detailed description of the API purpose
paths:
/{endpoint}:
post:
summary: Brief description
description: Detailed description
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/{Schema}'
responses:
'200':
description: Success response
'400':
description: Error scenarios- Define reusable components in
/api/components/index.yaml - Reference common schemas using
$ref - Avoid duplication across specifications
Each domain repository MUST have a README with:
- Domain overview and supported categories
- Version information
- Quick start guide
- Links to detailed documentation
- Contact information
For each API endpoint, document:
- Purpose and use cases
- Request/response formats
- Required vs optional fields
- Business rules and validations
- Error scenarios
- Example flows
Include in /api/docs/:
- Business Requirements Document (BRD)
- Product Requirements Document (PRD)
- API mapping documentation
- Integration guidelines
Follow semantic versioning: draft-MAJOR.MINOR.PATCH
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes
- Align with Beckn protocol version
- Document version compatibility matrix
- Maintain backward compatibility for at least 2 minor versions
For each version update:
- Update CHANGELOG.md with detailed changes
- Tag release in Git
- Update all affected documentation
Before committing:
- Validate YAML/JSON syntax
- Check for required fields
- Ensure examples match schemas
- Run build utilities to verify compilation
- All examples MUST be valid according to schemas
- Include both success and error scenarios
- Test edge cases
- Run
build_utilto compile specifications - Verify generated files in
/api/build/ - Check for build errors or warnings
- Create feature branches:
feature/{domain}-{feature-name} - Bug fixes:
fix/{domain}-{issue-number} - Documentation:
docs/{domain}-{topic}
PRs MUST include:
- Descriptive title with domain prefix
- Summary of changes
- Link to related issues
- Test results
- Documentation updates
- Reviewer checklist
Reviewers will check:
- Adherence to these guidelines
- Technical accuracy
- Backward compatibility
- Documentation completeness
- Example validity
Use standardized ONDC category codes:
- Format:
ONDC:{DOMAIN}{NUMBER} - Example:
ONDC:SRV10,ONDC:RET01 - Document category mapping in README
Define flows for:
- Standard transaction flow
- Cancellation scenarios
- Update/modification flows
- Error handling flows
- Edge cases
- Define domain-specific attributes
- Create comprehensive enum lists
- Document business rules
- Provide validation logic
{DOMAIN}-{CATEGORY}-{NUMBER}
Example: SRV-VALIDATION-001
For each error code, provide:
- Error code
- HTTP status
- Error message
- Description
- Resolution steps
- Ensure specifications render correctly in UI
- Test navigation and search functionality
- Verify example display
- Check responsive design
Support for:
- API testing interface
- Example switching (JSON/YAML)
- Schema navigation
- Search functionality
- Review specifications quarterly
- Update deprecated features
- Incorporate feedback
- Align with ONDC policy changes
- Use GitHub issues for tracking
- Label issues by domain and type
- Prioritize security and breaking changes
- Maintain issue templates
- Never include real credentials in examples
- Use placeholder values
- Document security requirements
- Include authentication/authorization specs
- Follow ONDC privacy guidelines
- Mask personal information in examples
- Document data retention policies
- Include consent mechanisms
- Make changes in the individual specification repository
- Follow the versioning and release process for that repository
- Notify the hub maintainers when significant updates are released
- Regularly update submodules to include latest stable versions
- Ensure all submodules are pointing to stable releases
- Document any breaking changes in the main repository
- Always work on the individual specification repositories
- Follow the contribution guidelines of each specification repository
- Do not make direct changes to submodules from this hub repository
- Always use recursive clone when setting up the repository
- Check submodule status before making updates
- Update submodules individually when working on specific domains
- Test compatibility when updating multiple submodules
- Document breaking changes in commit messages
- Use meaningful commit messages when updating submodules
To contribute to specific specifications:
- Navigate to the individual specification repository
- Follow the contribution guidelines for that repository
- Submit pull requests to the specific repository, not this hub
git submodule update --init --recursivecd SPECIFICATIONS/[submodule-name]
git checkout main
git pull origin maincd SPECIFICATIONS/[submodule-name]
git status # Check the conflict
git checkout --theirs . # or --ours depending on your needs- Created directory structure
- Added API specification files
- Included request/response examples
- Defined attributes and enums
- Created flow diagrams
- Updated error codes
- Written documentation
- Validated all files
- Run build process
- Updated README
- Created PR with description
- Passed review process
openapi: 3.0.0
info:
title: ONDC {Service} API
version: draft-2.0.0
description: |
API specification for {service description}
Transaction Specifications:
This API follows ONDC Transaction Specifications for audit, logging, and error handling.
Reference: ./ONDC-transaction-Specifications/
servers:
- url: https://api.ondc.org/{domain}
description: Production server
paths:
/{endpoint}:
post:
summary: {Action description}
operationId: {actionName}
tags:
- {Service Category}
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/{RequestSchema}'
examples:
example1:
$ref: '#/components/examples/{ExampleName}'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/{ResponseSchema}'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
# Define schemas here
examples:
# Define examples here# {Service} Flow Documentation
## Overview
Brief description of the service flow
## Participants
- Buyer App (BAP)
- Seller App (BPP)
- Gateway
## Flow Steps
### 1. Discovery
Description of discovery phase
### 2. Order Creation
Description of order creation
### 3. Fulfillment
Description of fulfillment process
### 4. Completion
Description of completion phase
## Error Scenarios
List of possible error scenarios
## Business Rules
Important business rules to considerNote: This repository structure uses Git submodules. Make sure you understand Git submodules before making changes.