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

# Create or update a batch of deals by unique property values

> 「idProperty」クエリーパラメーターによる指定通り、固有のプロパティー値によって特定されるレコードを作成または更新します。「idProperty」クエリーパラメーターはオブジェクトについて値が固有のプロパティーを参照します。

export const ScopesList = ({scopes = [], description = "この API には、次のいずれかのスコープが必要です。"}) => {
  if (!scopes || scopes.length === 0) {
    return null;
  }
  const sortedScopes = scopes.sort((a, b) => a.localeCompare(b));
  return <div>
      <div className="text-sm mb-2">{description}</div>
      <div>
        {sortedScopes.map((scope, index) => <div key={index}>
            <code>
              <span className="text-xs">{scope}</span>
            </code>
          </div>)}
      </div>
    </div>;
};

export const SupportedProducts = ({marketing, sales, service, cms, marketingLevel, salesLevel, serviceLevel, cmsLevel}) => {
  const translations = {
    header: "サポートされる製品",
    description: "次のいずれかの製品またはそれ以上が必要です。",
    productNames: {
      marketing: "Marketing Hub",
      sales: "Sales Hub",
      service: "Service Hub",
      cms: "Content Hub"
    },
    tiers: {
      free: "無料ツール",
      starter: "Starter",
      professional: "Professional",
      enterprise: "Enterprise"
    }
  };
  const translateTier = tier => {
    if (!tier) return '';
    const lowerTier = tier.toLowerCase();
    return translations.tiers[lowerTier] || tier;
  };
  const products = [{
    name: marketing ? translations.productNames.marketing : '',
    level: translateTier(marketingLevel),
    icon: "https://mintlify-assets.b-cdn.net/Icons/marketing-bolt.svg",
    alt: "Marketing Hub"
  }, {
    name: sales ? translations.productNames.sales : '',
    level: translateTier(salesLevel),
    icon: "https://mintlify-assets.b-cdn.net/Icons/sales-star.svg",
    alt: "Sales Hub"
  }, {
    name: service ? translations.productNames.service : '',
    level: translateTier(serviceLevel),
    icon: "https://mintlify-assets.b-cdn.net/Icons/service-heart.svg",
    alt: "Service Hub"
  }, {
    name: cms ? translations.productNames.cms : '',
    level: translateTier(cmsLevel),
    icon: "https://mintlify-assets.b-cdn.net/Icons/content-play.svg",
    alt: "Content Hub"
  }].filter(product => product.name && product.level);
  if (products.length === 0) return null;
  return <div>
      <div className="text-sm mb-2">{translations.description}</div>
      <div className={`grid ${products.length === 1 ? 'grid-cols-1' : 'grid-cols-2'} gap-1.5`}>
        {products.map((product, index) => <div key={index} style={{
    display: 'flex',
    alignItems: 'center'
  }}>
            <img src={product.icon} alt={product.alt} className="w-3.5 h-3.5 mr-1.5 mt-2.5 mb-2.5 flex-shrink-0 align-middle" />
            <span className="font-medium mr-1 text-sm">{product.name} -</span>
            <span className="text-sm">{product.level}</span>
          </div>)}
      </div>
    </div>;
};

<AccordionGroup>
  <Accordion title="Supported products" defaultOpen="true" icon="cubes">
    <SupportedProducts marketing={true} sales={true} service={true} cms={true} marketingLevel="FREE" salesLevel="FREE" serviceLevel="FREE" cmsLevel="FREE" />
  </Accordion>

  <Accordion title="Required Scopes" icon="key">
    <ScopesList
      scopes={[
  'crm.objects.deals.write'
]}
    />
  </Accordion>
</AccordionGroup>


## OpenAPI

````yaml specs/legacy/v3/crm-deals-v3.json POST /crm/v3/objects/0-3/batch/upsert
openapi: 3.0.1
info:
  title: 取引
  description: >-
    CRM objects such as companies, contacts, deals, line items, products,
    tickets, and quotes are standard objects in HubSpot’s CRM. These core
    building blocks support custom properties, store critical information, and
    play a central role in the HubSpot application.


    ## Supported Object Types


    This API provides access to collections of CRM objects, which return a map
    of property names to values. Each object type has its own set of default
    properties, which can be found by exploring the [CRM Object Properties
    API](https://developers.hubspot.com/docs/methods/crm-properties/crm-properties-overview).


    |Object Type |Properties returned by default |

    |--|--|

    | `companies` | `name`, `domain` |

    | `contacts` | `firstname`, `lastname`, `email` |

    | `deals` | `dealname`, `amount`, `closedate`, `pipeline`, `dealstage` |

    | `products` | `name`, `description`, `price` |

    | `tickets` | `content`, `hs_pipeline`, `hs_pipeline_stage`,
    `hs_ticket_category`, `hs_ticket_priority`, `subject` |


    Find a list of all properties for an object type using the [CRM Object
    Properties](https://developers.hubspot.com/docs/methods/crm-properties/get-properties)
    API. e.g. `GET https://api.hubapi.com/properties/v2/companies/properties`.
    Change the properties returned in the response using the `properties` array
    in the request body.
  version: v3
  x-hubspot-product-tier-requirements:
    marketing: FREE
    sales: FREE
    service: FREE
    cms: FREE
    commerce: FREE
    crmHub: FREE
    dataHub: FREE
  x-hubspot-api-use-case: >-
    営業担当が見込み客への対応を開始するときに、交渉プロセスを追跡する取引レコードを作成します。その後、顧客が購入を行ったら、取引をクローズ済みステージに更新できます。
  x-hubspot-related-documentation:
    - name: Deals Guide
      url: https://developers.hubspot.com/docs/guides/api/crm/objects/deals
  x-hubspot-introduction: >-
    取引APIを使用して、コンタクトや会社とのトランザクションを表すCRMレコードの作成や管理を行います。取引はパイプラインステージを進み、取引が完了したか、現在進行中であるか、失注になったかが反映されます。
servers:
  - url: https://api.hubapi.com
security: []
tags:
  - name: Basic
  - name: Batch
  - name: Search
paths:
  /crm/v3/objects/0-3/batch/upsert:
    post:
      tags:
        - Batch
      summary: 固有のプロパティー値を基準に取引をバッチ作成またはバッチ更新
      description: >-
        「idProperty」クエリーパラメーターによる指定通り、固有のプロパティー値によって特定されるレコードを作成または更新します。「idProperty」クエリーパラメーターはオブジェクトについて値が固有のプロパティーを参照します。
      operationId: post-/crm/v3/objects/0-3/batch/upsert_upsert
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/BatchInputSimplePublicObjectBatchInputUpsert
        required: true
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchResponseSimplePublicUpsertObject'
        '207':
          description: multiple statuses
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/BatchResponseSimplePublicUpsertObjectWithErrors
        default:
          $ref: '#/components/responses/Error'
          description: ''
      security:
        - oauth2:
            - crm.objects.deals.write
components:
  schemas:
    BatchInputSimplePublicObjectBatchInputUpsert:
      required:
        - inputs
      type: object
      properties:
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/SimplePublicObjectBatchInputUpsert'
    BatchResponseSimplePublicUpsertObject:
      required:
        - completedAt
        - results
        - startedAt
        - status
      type: object
      properties:
        completedAt:
          type: string
          description: バッチ処理が完了した時刻のタイムスタンプ（ISO 8601形式）。
          format: date-time
        links:
          type: object
          additionalProperties:
            type: string
          description: バッチリクエストに関連する、関連性の高いリンクを含むオブジェクト。
        requestedAt:
          type: string
          description: バッチ処理が開始された時刻のタイムスタンプ（ISO 8601形式）。
          format: date-time
        results:
          type: array
          items:
            $ref: '#/components/schemas/SimplePublicUpsertObject'
        startedAt:
          type: string
          description: バッチ処理の実行が開始された時刻のタイムスタンプ（ISO 8601形式）。
          format: date-time
        status:
          type: string
          description: バッチ処理リクエストのステータス。想定される値は「COMPLETE」です。
          enum:
            - CANCELED
            - COMPLETE
            - PENDING
            - PROCESSING
      description: >-
        バッチ更新／挿入処理の結果を表します。これには、オペレーションのステータス、タイムスタンプ、および正常に作成または更新されたオブジェクトのリストが含まれます。
    BatchResponseSimplePublicUpsertObjectWithErrors:
      required:
        - completedAt
        - results
        - startedAt
        - status
      type: object
      properties:
        completedAt:
          type: string
          description: バッチ処理が完了した時刻のタイムスタンプ（ISO 8601形式）。
          format: date-time
        errors:
          type: array
          items:
            $ref: '#/components/schemas/StandardError'
        links:
          type: object
          additionalProperties:
            type: string
          description: バッチリクエストに関連する、関連性の高いリンクを含むオブジェクト。
        numErrors:
          type: integer
          description: バッチ処理中に発生したエラーの数。
          format: int32
        requestedAt:
          type: string
          description: バッチ処理が開始された時刻のタイムスタンプ（ISO 8601形式）。
          format: date-time
        results:
          type: array
          items:
            $ref: '#/components/schemas/SimplePublicUpsertObject'
        startedAt:
          type: string
          description: バッチ処理の実行が開始された時刻のタイムスタンプ（ISO 8601形式）。
          format: date-time
        status:
          type: string
          description: >-
            バッチ処理リクエストのステータス。「PENDING」、「PROCESSING」、「CANCELLED」、または「COMPLETE」にできます。
          enum:
            - CANCELED
            - COMPLETE
            - PENDING
            - PROCESSING
      description: >-
        Represents the response from a batch upsert operation, including the
        status, timestamps, successfully processed objects, and any errors that
        occurred during processing.
    SimplePublicObjectBatchInputUpsert:
      required:
        - id
        - properties
      type: object
      properties:
        id:
          type: string
          description: オブジェクトの固有ID。
        idProperty:
          type: string
          description: このオブジェクトについて値が固有のプロパティーの名前
        objectWriteTraceId:
          type: string
          description: 作成リクエストをトレースするためのID。
        properties:
          type: object
          additionalProperties:
            type: string
          description: オブジェクトのプロパティーを表す、キーと値のペア。
      description: >-
        バッチ更新／挿入処理で使用されるオブジェクトを表します。オブジェクトの固有ID、そのプロパティー、およびオプションで固有プロパティー名と書き込みトレースIDを含みます。
    SimplePublicUpsertObject:
      required:
        - archived
        - createdAt
        - id
        - new
        - properties
        - updatedAt
      type: object
      properties:
        archived:
          type: boolean
          description: オブジェクトがアーカイブされているかどうか。
        archivedAt:
          type: string
          description: オブジェクトがアーカイブされた時点のタイムスタンプ（ISO 8601形式）。
          format: date-time
        createdAt:
          type: string
          description: オブジェクトが作成された時点のタイムスタンプ（ISO 8601形式）。
          format: date-time
        id:
          type: string
          description: オブジェクトの固有ID。
        new:
          type: boolean
          description: オブジェクトが作成されるかどうか。
        objectWriteTraceId:
          type: string
          description: オブジェクトの作成リクエストまたは更新リクエストをトレースするために使用されるID。
        properties:
          type: object
          additionalProperties:
            type: string
          description: オブジェクトのプロパティーを表す、キーと値のペア。
        propertiesWithHistory:
          type: object
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/ValueWithTimestamp'
          description: オブジェクトのプロパティーとその履歴を表すキーと値のペア。
        updatedAt:
          type: string
          description: オブジェクトが最後に更新された時点のタイムスタンプ（ISO 8601形式）。
          format: date-time
        url:
          type: string
          description: オブジェクトに関連付けられたURL。
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/PublicObjectWarning'
      description: 作成または更新された（更新／挿入された）CRMオブジェクトを表します
    StandardError:
      required:
        - category
        - context
        - errors
        - links
        - message
        - status
      type: object
      properties:
        category:
          type: string
          description: エラーの主カテゴリー。
        context:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          description: エラーに関連する、状況に固有の追加情報。
        errors:
          type: array
          description: 詳細なエラーオブジェクト。
          items:
            $ref: '#/components/schemas/ErrorDetail'
        id:
          type: string
          description: エラーインスタンスの固有ID。
        links:
          type: object
          additionalProperties:
            type: string
          description: エラーに関連付けられているドキュメントまたは資料につながるURL。
        message:
          type: string
          description: エラーと取り得る修正手順を記した、人が理解できる文字列。
        status:
          type: string
          description: エラーに関連付けられたHTTPステータスコード。
        subCategory:
          type: object
          properties: {}
          description: それぞれの主カテゴリー内の、さらに具体的なエラーカテゴリー。
      description: HubSpot APIにおける標準的なエラーレスポンスを表し、APIリクエスト中に発生したエラーに関する詳細情報を提供します。
    Error:
      required:
        - category
        - correlationId
        - message
      type: object
      properties:
        category:
          type: string
          description: エラーカテゴリー
        context:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          description: エラー条件に関する背景状況
          example: >-
            {invalidPropertyName=[propertyValue], missingScopes=[scope1,
            scope2]}
        correlationId:
          type: string
          description: リクエストの固有ID。エラー報告またはサポートチケットには必ずこの値を含めてください
          format: uuid
          example: aeb5f871-7f07-4993-9211-075dc63e7cbf
        errors:
          type: array
          description: エラーに関する詳細情報
          items:
            $ref: '#/components/schemas/ErrorDetail'
        links:
          type: object
          additionalProperties:
            type: string
          description: エラーまたは推奨の修正手順に関するドキュメントが含まれる関連付けられたURIへのリンク名の対応付け
        message:
          type: string
          description: エラーと修正手順（該当する場合）を記した、人が理解できるメッセージ
          example: An error occurred
        subCategory:
          type: string
          description: エラーに関する具体的な詳細が含まれる特定のカテゴリー
      example:
        message: Invalid input (details will vary based on the error)
        correlationId: aeb5f871-7f07-4993-9211-075dc63e7cbf
        category: VALIDATION_ERROR
        links:
          knowledge-base: https://www.hubspot.com/products/service/knowledge-base
    ValueWithTimestamp:
      required:
        - sourceType
        - timestamp
        - value
      type: object
      properties:
        sourceId:
          type: string
          description: プロパティーの固有ID。
        sourceLabel:
          type: string
          description: 人間が読めるラベル。
        sourceType:
          type: string
          description: プロパティーのタイプ。
        timestamp:
          type: string
          description: プロパティーが更新された時刻のタイムスタンプ（ISO 8601形式）。
          format: date-time
        updatedByUserId:
          type: integer
          description: プロパティーを最後に更新したユーザーのID。
          format: int32
        value:
          type: string
          description: プロパティー値。
      description: タイムスタンプを含むプロパティーモデル。
    PublicObjectWarning:
      required:
        - category
        - context
        - message
      type: object
      properties:
        category:
          type: string
        context:
          type: object
          additionalProperties:
            type: string
        message:
          type: string
    ErrorDetail:
      required:
        - message
      type: object
      properties:
        code:
          type: string
          description: エラーの詳細に関連付けられているステータスコード
        context:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          description: エラー条件に関する背景状況
          example: '{missingScopes=[scope1, scope2]}'
        in:
          type: string
          description: エラーが見つかったフィールドまたはパラメーターの名前。
        message:
          type: string
          description: エラーと修正手順（該当する場合）を記した、人が理解できるメッセージ
        subCategory:
          type: string
          description: エラーに関する具体的な詳細が含まれる特定のカテゴリー
  responses:
    Error:
      description: An error occurred.
      content:
        '*/*':
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://app.hubspot.com/oauth/authorize
          tokenUrl: https://api.hubapi.com/oauth/v1/token
          scopes:
            crm.objects.commercepayments.read: ''
            crm.objects.deals.read: ''
            crm.objects.deals.write: ''
            oauth: ''

````