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

# Creates or updates a contract

> Creates a new contract or updates an existing one based on the contract reference.



## OpenAPI

````yaml /specs/fuelboss/fuelboss-api.json put /v1/contracts
openapi: 3.1.1
info:
  title: FuelBoss API
  description: >-
    REST API providing a powerful and easy way to manage your companies
    nominations and operations.
  termsOfService: https://www.ofiniti.com/legal/platform-service-terms
  contact:
    name: Support Team
    email: itops@ofiniti.com
  version: 1.15.1
servers:
  - url: https://api.demo.fuelboss.net
    description: Demo (sandbox for testing and integration development)
  - url: https://api.fuelboss.net
    description: Production
security:
  - bearerAuth: []
tags:
  - name: OAuth
  - name: Nominations
  - name: Entity management
  - name: Operations
  - name: Common
  - name: Webhooks
  - name: Webhook events
paths:
  /v1/contracts:
    put:
      tags:
        - Entity management
      summary: Creates or updates a contract
      description: >-
        Creates a new contract or updates an existing one based on the contract
        reference.
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/FuelBoss.Api.Contracts.Api.Contract.UpsertContractRequest
              description: >-
                Request body for creating or updating a contract. The contract
                is identified by its reference.
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/FuelBoss.Api.Contracts.Api.Contract.UpsertContractResponse
                description: Response returned after creating or updating a contract.
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/FuelBoss.Api.Contracts.Api.Contract.UpsertContractResponse
                description: Response returned after creating or updating a contract.
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    format: uri
                  title:
                    type: string
                  status:
                    type: integer
                  detail:
                    type: string
                  instance:
                    type: string
                    format: uri
                  timestamp:
                    type: string
                    format: date-time
                  trace_id:
                    type: string
                description: >-
                  RFC 9457 Problem Details response - fully compliant with
                  latest standard

                  https://tools.ietf.org/html/rfc9457
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    format: uri
                  title:
                    type: string
                  status:
                    type: integer
                  detail:
                    type: string
                  instance:
                    type: string
                    format: uri
                  timestamp:
                    type: string
                    format: date-time
                  trace_id:
                    type: string
                description: >-
                  RFC 9457 Problem Details response - fully compliant with
                  latest standard

                  https://tools.ietf.org/html/rfc9457
        '422':
          description: Unprocessable Content
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    format: uri
                  title:
                    type: string
                  status:
                    type: integer
                  detail:
                    type: string
                  instance:
                    type: string
                    format: uri
                  timestamp:
                    type: string
                    format: date-time
                  trace_id:
                    type: string
                description: >-
                  RFC 9457 Problem Details response - fully compliant with
                  latest standard

                  https://tools.ietf.org/html/rfc9457
components:
  schemas:
    FuelBoss.Api.Contracts.Api.Contract.UpsertContractRequest:
      type: object
      properties:
        name:
          type: string
          description: Contract name.
        reference:
          type: string
          description: >-
            Unique reference for the contract, used as `contractReference` on
            nominations.
        externalReference:
          type:
            - 'null'
            - string
          description: External reference for the contract in your own systems.
        type:
          enum:
            - term
            - spot
          type:
            - 'null'
            - string
          description: |-
            Contract type.

            Possible values:

            - `term` — Term contract.
            - `spot` — Spot contract.
        supplierEntities:
          type: array
          items:
            type: string
          description: >-
            Company entity references of the supplier entities covered by the
            contract (from [Get Company
            Entities](/api-reference/entity-management/retrieves-all-entities-available-for-your-company)).
        ports:
          type: array
          items:
            type: string
          description: UN/LOCODEs of the ports covered by the contract.
        counterpartCompanies:
          type: array
          items:
            type: string
          description: >-
            Identifiers of the counterpart companies covered by the contract
            (from [Get
            Companies](/api-reference/common/retrieves-all-companies-available)).
        counterpartEntities:
          type: array
          items:
            type: string
          description: >-
            References of the counterpart entities covered by the contract (from
            [Get Counterpart
            Entities](/api-reference/entity-management/retrieves-all-counterpart-entities-available-for-your-company)).
        priceType:
          enum:
            - floating
            - fixed
          type:
            - 'null'
            - string
          description: |-
            Price type.

            Possible values:

            - `floating` — Floating price.
            - `fixed` — Fixed price.
        startDateUtc:
          type:
            - 'null'
            - string
          description: Start of the contract validity period (UTC).
          format: date-time
        endDateUtc:
          type:
            - 'null'
            - string
          description: End of the contract validity period (UTC).
          format: date-time
      additionalProperties: false
      description: >-
        Request body for creating or updating a contract. The contract is
        identified by its reference.
    FuelBoss.Api.Contracts.Api.Contract.UpsertContractResponse:
      type: object
      properties:
        contractReference:
          type: string
          description: Unique reference of the created or updated contract.
        lastChangedAtUtc:
          type: string
          description: Timestamp (UTC) of the last change to the contract.
          format: date-time
      additionalProperties: false
      description: Response returned after creating or updating a contract.
  securitySchemes:
    bearerAuth:
      type: http
      description: >-
        Access token obtained from the /oauth/token endpoint using your client
        credentials.
      scheme: bearer
      bearerFormat: JWT

````