> ## Documentation Index
> Fetch the complete documentation index at: https://docs.justpaid.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Contract Api

> Creates a contract based on a template and selected option.



## OpenAPI

````yaml post /api/v1/template/create-contract
openapi: 3.1.0
info:
  title: NinjaAPI
  version: 1.0.0
  description: ''
servers:
  - url: https://api.justpaid.io
security: []
paths:
  /api/v1/template/create-contract:
    post:
      summary: Create Contract Api
      description: Creates a contract based on a template and selected option.
      operationId: loopfour_backend_template_api_external_create_contract_api
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractCreationIn'
        required: true
      responses:
        '201':
          description: Contract created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractCreationOut'
              example:
                contract_uuid: 123e4567-e89b-12d3-a456-426614174000
                message: Contract created successfully
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                additionalProperties: true
                title: Response
                type: object
              example:
                detail: Invalid service quantities provided
        '404':
          description: Required object not found
          content:
            application/json:
              schema:
                additionalProperties: true
                title: Response
                type: object
              example:
                detail: Customer/Template/Option not found
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                additionalProperties: true
                title: Response
                type: object
      security:
        - HttpBearerAuth: []
components:
  schemas:
    ContractCreationIn:
      description: Schema for contract creation request.
      properties:
        customer_uuid:
          description: UUID of the customer
          format: uuid
          title: Customer Uuid
          type: string
        template_uuid:
          description: UUID of the template
          format: uuid
          title: Template Uuid
          type: string
        option_uuid:
          description: UUID of the selected option
          format: uuid
          title: Option Uuid
          type: string
        service_quantities:
          description: List of service quantities with their respective UUIDs
          items:
            $ref: '#/components/schemas/ServiceQuantityIn'
          title: Service Quantities
          type: array
        contract_start_date:
          anyOf:
            - format: date
              type: string
            - type: 'null'
          description: Start date of the contract
          title: Contract Start Date
        invoice_start_date:
          anyOf:
            - format: date
              type: string
            - type: 'null'
          description: Invoice start date of the contract
          title: Invoice Start Date
      required:
        - customer_uuid
        - template_uuid
        - option_uuid
        - service_quantities
      title: ContractCreationIn
      type: object
    ContractCreationOut:
      description: Schema for contract creation response.
      properties:
        contract_uuid:
          description: UUID of the created contract
          title: Contract Uuid
          type: string
        message:
          description: Success message
          title: Message
          type: string
      required:
        - contract_uuid
        - message
      title: ContractCreationOut
      type: object
    ServiceQuantityIn:
      description: Schema for service quantity mapping.
      properties:
        service_uuid:
          description: UUID of the service
          format: uuid
          title: Service Uuid
          type: string
        quantity:
          description: Quantity of the service
          minimum: 1
          title: Quantity
          type: integer
      required:
        - service_uuid
        - quantity
      title: ServiceQuantityIn
      type: object
  securitySchemes:
    HttpBearerAuth:
      type: http
      scheme: bearer

````