# Create or Update Contract Service Agreement

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/contract/service-agreement:
    post:
      summary: Create or Update Contract Service Agreement
      deprecated: false
      description: ''
      tags:
        - Venio/Contract
      parameters:
        - name: Content-Type
          in: header
          description: ''
          required: true
          example: application/json
          schema:
            type: string
        - name: Ocp-Apim-Subscription-Key
          in: header
          description: รหัส subscriptionของลูกค้า
          required: true
          example: <Your-Subscription-Key>
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              x-apidog-refs:
                01JYH1P1W5VV56CSBEY4VJ12ZT: &ref_1
                  $ref: '#/components/schemas/ContractServiceDto'
                  x-apidog-overrides:
                    contractServiceId: &ref_0
                      type: integer
                      nullable: true
                    activityServices: null
                  required:
                    - contractNo
              x-apidog-orders:
                - 01JYH1P1W5VV56CSBEY4VJ12ZT
              properties:
                contractNo:
                  type: string
                  description: หมายเลขสัญญา
                contractServiceId: *ref_0
                subject:
                  type: string
                  description: หัวข้อ Service Agreement
                frequency:
                  type: integer
                  description: >-
                    <p>ประเภทความถี่<br>Yearly = 260001<br>Quarterly =
                    260002<br>Monthly = 260003<br>Weekly = 26000</p>
                numberOfTimes:
                  type: integer
                  description: จำนวนครั้ง
                agreementNote:
                  type: string
                  description: บันทึก
                  nullable: true
              required:
                - contractNo
                - subject
                - frequency
                - numberOfTimes
              x-apidog-ignore-properties:
                - contractNo
                - contractServiceId
                - subject
                - frequency
                - numberOfTimes
                - agreementNote
            example:
              contractNo: string
              contractServiceId: 37881
              subject: string
              frequency: 260001
              numberOfTimes: 1
              agreementNote: null
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: *ref_1
                  statusCode:
                    type: integer
                  httpStatusCode:
                    type: integer
                required:
                  - data
                  - statusCode
                  - httpStatusCode
                x-apidog-orders:
                  - data
                  - statusCode
                  - httpStatusCode
                x-apidog-ignore-properties: []
              example:
                status:
                  code: '1000'
                  description: Success
                data:
                  contractServiceId: 37923
                  contractNo: string
                  frequency: 260001
                  subject: string
                  numberOfTimes: 1
                  activityServices:
                    - title: '#1 string'
                      dateStart: 2025-06-18T00:00:00+0700
                      dateEnd: 2026-06-17T00:00:00+0700
                    - title: '#2 string'
                      dateStart: 2026-06-18T00:00:00+0700
                      dateEnd: 2026-06-18T00:00:00+0700
          headers: {}
          x-apidog-name: Success
        '400':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: object
                    properties:
                      code:
                        type: string
                      description:
                        type: string
                    required:
                      - code
                      - description
                    x-apidog-orders:
                      - code
                      - description
                    x-apidog-ignore-properties: []
                  data:
                    type: object
                    properties:
                      errors:
                        type: array
                        items:
                          type: object
                          properties:
                            subCode:
                              type: string
                            description:
                              type: string
                          x-apidog-orders:
                            - subCode
                            - description
                          x-apidog-ignore-properties: []
                      value:
                        type: string
                      statusCode:
                        type: integer
                    required:
                      - errors
                      - value
                      - statusCode
                    x-apidog-orders:
                      - errors
                      - value
                      - statusCode
                    x-apidog-ignore-properties: []
                  hasError:
                    type: boolean
                  errorMessage:
                    type: string
                  statusCode:
                    type: integer
                  httpStatusCode:
                    type: integer
                required:
                  - status
                  - data
                  - hasError
                  - errorMessage
                  - statusCode
                  - httpStatusCode
                x-apidog-orders:
                  - status
                  - data
                  - hasError
                  - errorMessage
                  - statusCode
                  - httpStatusCode
                x-apidog-ignore-properties: []
              example:
                status:
                  code: '4001'
                  description: Business error with 1 or more errors
                data:
                  errors:
                    - subCode: E1101
                      description: Subject field is required.
          headers: {}
          x-apidog-name: Bad Request
      security:
        - bearerAuth: []
          x-apidog:
            schemeGroups:
              - id: uyL_cJmK7q60QJZRTi5ot
                schemeIds:
                  - bearerAuth
            required: true
            use:
              id: uyL_cJmK7q60QJZRTi5ot
            scopes:
              uyL_cJmK7q60QJZRTi5ot:
                bearerAuth: []
      x-apidog-folder: Venio/Contract
      x-apidog-status: developing
      x-run-in-apidog: https://app.apidog.com/web/project/351895/apis/api-18402720-run
components:
  schemas:
    ContractServiceDto:
      type: object
      properties:
        contractNo:
          type: string
          description: หมายเลขสัญญา
        contractServiceId:
          type: integer
        subject:
          type: string
          description: หัวข้อ Service Agreement
        frequency:
          type: integer
          description: >-
            <p>ประเภทความถี่<br>Yearly = 260001<br>Quarterly = 260002<br>Monthly
            = 260003<br>Weekly = 26000</p>
        numberOfTimes:
          type: integer
          description: จำนวนครั้ง
        agreementNote:
          type: string
          description: บันทึก
          nullable: true
        activityServices:
          type: array
          items:
            properties:
              title:
                type: string
              dateStart:
                type: string
              dateEnd:
                type: string
            x-apidog-orders:
              - title
              - dateStart
              - dateEnd
            required:
              - title
              - dateStart
              - dateEnd
            $ref: '#/components/schemas/ActivityServiceDto'
          description: รายการกิจกรรมสัญญา
      required:
        - contractNo
        - contractServiceId
        - subject
        - frequency
        - numberOfTimes
        - activityServices
      x-apidog-orders:
        - contractNo
        - contractServiceId
        - subject
        - frequency
        - numberOfTimes
        - agreementNote
        - activityServices
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    ActivityServiceDto:
      type: object
      properties:
        title:
          type: string
          description: หัวข้อ
        dateStart:
          type: string
          description: วันที่เริ่ม
        dateEnd:
          type: string
          description: วันที่สิ้นสุด
      x-apidog-orders:
        - title
        - dateStart
        - dateEnd
      required:
        - title
        - dateStart
        - dateEnd
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
  securitySchemes:
    bearerAuth:
      type: jwt
      scheme: bearer
      bearerFormat: JWT
      description: ใส่ JWT Token ในรูปแบบ Bearer {token}
    bearer:
      type: bearer
      scheme: bearer
servers:
  - url: https://api.gofive.co.th
    description: Production
security:
  - bearerAuth: []
    x-apidog:
      schemeGroups:
        - id: uyL_cJmK7q60QJZRTi5ot
          schemeIds:
            - bearerAuth
      required: true
      use:
        id: uyL_cJmK7q60QJZRTi5ot
      scopes:
        uyL_cJmK7q60QJZRTi5ot:
          bearerAuth: []

```
