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

# Creer ou mettre a jour une operation externe

> Crée ou met à jour immédiatement une opération à partir d'un identifiant partenaire stable. La réponse contient directement marko_id. Une valeur de taxonomie inconnue est créée pour l'entité, visible immédiatement et signalée dans taxonomy_additions. Le segment généré des codes `custom__...` n'est pas prévisible : le client doit conserver le code renvoyé et le réutiliser. Une création répond 201; une mise à jour, restauration ou répétition sans changement répond 200. Les notes utilisent leur endpoint dédié; seul POST /operations/batch reste asynchrone.



## OpenAPI

````yaml https://partner-api.marko.fr/v1/openapi.json put /operations/external/{external_id}
openapi: 3.1.0
info:
  title: MARKO External Partner API
  version: v1
  description: >-
    Stable external API contract for the live environment.


    Authentication flow for partner integrations:

    1. Generate an API key from the MARKO entity admin API section.

    2. Keep the raw API secret server-side and use it only to sign `POST
    /v1/auth/token`.

    3. Build the canonical message
    `MARKO-EXTERNAL-API-TOKEN-V1\n{key_id}\n{timestamp}\n{nonce}`.

    4. Sign that message with HMAC-SHA256 and send the hex signature with
    `key_id`, `timestamp` and `nonce`.

    5. Use the returned short-lived bearer on business endpoints as
    `Authorization: Bearer <access_token>`.

    The raw API secret must never be sent on business endpoints.


    This public contract intentionally excludes beta endpoints.
servers:
  - url: https://partner-api.marko.fr/v1
security:
  - BearerAuth: []
externalDocs:
  description: Download the matching Postman collection.
  url: /v1/postman.json
paths:
  /operations/external/{external_id}:
    put:
      tags:
        - operations
      summary: Creer ou mettre a jour une operation externe
      description: >-
        Crée ou met à jour immédiatement une opération à partir d'un identifiant
        partenaire stable. La réponse contient directement marko_id. Une valeur
        de taxonomie inconnue est créée pour l'entité, visible immédiatement et
        signalée dans taxonomy_additions. Le segment généré des codes
        `custom__...` n'est pas prévisible : le client doit conserver le code
        renvoyé et le réutiliser. Une création répond 201; une mise à jour,
        restauration ou répétition sans changement répond 200. Les notes
        utilisent leur endpoint dédié; seul POST /operations/batch reste
        asynchrone.
      operationId: operations_upsert
      parameters:
        - in: path
          name: external_id
          required: true
          schema:
            type: string
            pattern: ^[A-Za-z0-9_~-][A-Za-z0-9._:~-]{0,254}$
            minLength: 1
            maxLength: 255
          example: CF-OP-001
        - in: header
          name: X-Request-ID
          required: false
          description: >-
            Partner-generated correlation identifier echoed in logs and error
            payloads.
          schema:
            type: string
          example: marko-operations-upsert
        - in: header
          name: Idempotency-Key
          required: true
          description: >-
            Required for every write, including environments where replay
            deduplication is disabled. Reuse the same value when retrying the
            same logical write and use a new value for a different write.
          schema:
            type: string
            maxLength: 255
            pattern: ^[!-~]+$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                spv_id:
                  anyOf:
                    - type: string
                      format: uuid
                    - type: 'null'
                  default: null
                  title: Spv Id
                lead_operateur_id:
                  anyOf:
                    - type: string
                      format: uuid
                    - type: 'null'
                  default: null
                  title: Lead Operateur Id
                existing_marko_id:
                  anyOf:
                    - type: string
                      format: uuid
                    - type: 'null'
                  default: null
                  title: Existing Marko Id
                name:
                  maxLength: 255
                  minLength: 1
                  title: Name
                  type: string
                status:
                  anyOf:
                    - maxLength: 255
                      minLength: 1
                      type: string
                    - type: 'null'
                  default: null
                  title: Status
                type_investissement:
                  anyOf:
                    - maxLength: 255
                      minLength: 1
                      type: string
                    - type: 'null'
                  default: null
                  title: Type Investissement
                type_operation:
                  anyOf:
                    - maxLength: 255
                      minLength: 1
                      type: string
                    - type: 'null'
                  default: null
                  title: Type Operation
                classe_actif:
                  anyOf:
                    - maxLength: 255
                      minLength: 1
                      type: string
                    - type: 'null'
                  default: null
                  title: Classe Actif
                statut_interne:
                  anyOf:
                    - maxLength: 255
                      minLength: 1
                      type: string
                    - type: 'null'
                  default: null
                  title: Statut Interne
                statut_operationnel:
                  anyOf:
                    - items:
                        maxLength: 255
                        minLength: 1
                        type: string
                      maxItems: 100
                      type: array
                    - type: 'null'
                  default: null
                  title: Statut Operationnel
                sous_classe_actif:
                  anyOf:
                    - type: string
                    - type: 'null'
                  default: null
                  title: Sous Classe Actif
                data:
                  additionalProperties: true
                  title: Data
                  type: object
                kpi_snapshot:
                  anyOf:
                    - properties:
                        date_reference:
                          anyOf:
                            - format: date
                              type: string
                            - type: 'null'
                          default: null
                          title: Date Reference
                        crd_total:
                          anyOf:
                            - type: number
                            - pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
                              type: string
                            - type: 'null'
                          default: null
                          title: Crd Total
                        crd_total_source:
                          anyOf:
                            - maxLength: 32
                              type: string
                            - type: 'null'
                          default: null
                          title: Crd Total Source
                        crd_senior:
                          anyOf:
                            - type: number
                            - pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
                              type: string
                            - type: 'null'
                          default: null
                          title: Crd Senior
                        crd_mezzanine:
                          anyOf:
                            - type: number
                            - pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
                              type: string
                            - type: 'null'
                          default: null
                          title: Crd Mezzanine
                        valeur_venale:
                          anyOf:
                            - type: number
                            - pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
                              type: string
                            - type: 'null'
                          default: null
                          title: Valeur Venale
                        noi:
                          anyOf:
                            - type: number
                            - pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
                              type: string
                            - type: 'null'
                          default: null
                          title: Noi
                        service_dette:
                          anyOf:
                            - type: number
                            - pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
                              type: string
                            - type: 'null'
                          default: null
                          title: Service Dette
                        ltv:
                          anyOf:
                            - type: number
                            - pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
                              type: string
                            - type: 'null'
                          default: null
                          title: Ltv
                        dscr:
                          anyOf:
                            - type: number
                            - pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
                              type: string
                            - type: 'null'
                          default: null
                          title: Dscr
                        icr:
                          anyOf:
                            - type: number
                            - pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
                              type: string
                            - type: 'null'
                          default: null
                          title: Icr
                        ltc:
                          anyOf:
                            - type: number
                            - pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
                              type: string
                            - type: 'null'
                          default: null
                          title: Ltc
                        debt_yield:
                          anyOf:
                            - type: number
                            - pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
                              type: string
                            - type: 'null'
                          default: null
                          title: Debt Yield
                        risk_score_simple:
                          anyOf:
                            - type: number
                            - pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
                              type: string
                            - type: 'null'
                          default: null
                          title: Risk Score Simple
                        pct_perte_estimee:
                          anyOf:
                            - type: number
                            - pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
                              type: string
                            - type: 'null'
                          default: null
                          title: Pct Perte Estimee
                      title: ExternalKpiSnapshotInput
                      type: object
                    - type: 'null'
                  default: null
              required:
                - name
              title: ExternalOperationUpsertRequest
              type: object
            example:
              name: Clubfunding Demo Deal
              status: Projet émis
              type_investissement: dette_senior
              type_operation: acquisition_detention
              classe_actif: residentiel
              statut_interne: analyse
              statut_operationnel:
                - commercialisation
              sous_classe_actif: residentiel_coliving
              data:
                adresse: 12 rue de la Paix, Paris
              kpi_snapshot:
                date_reference: '2026-07-15'
                crd_total: 2500000
                valeur_venale: 3400000
                ltv: 0.7353
      responses:
        '200':
          description: Successful response for the accompanying request example
          content:
            application/json:
              schema:
                properties:
                  external_id:
                    title: External Id
                    type: string
                  marko_id:
                    format: uuid
                    title: Marko Id
                    type: string
                  outcome:
                    enum:
                      - created
                      - updated
                      - noop
                      - restored
                      - bound
                    title: Outcome
                    type: string
                  resource:
                    properties:
                      id:
                        format: uuid
                        title: Id
                        type: string
                      spv_id:
                        anyOf:
                          - type: string
                            format: uuid
                          - type: 'null'
                        default: null
                        title: Spv Id
                      lead_operateur_id:
                        anyOf:
                          - type: string
                            format: uuid
                          - type: 'null'
                        default: null
                        title: Lead Operateur Id
                      name:
                        title: Name
                        type: string
                      status:
                        title: Status
                        type: string
                      type_investissement:
                        anyOf:
                          - type: string
                          - type: 'null'
                        default: null
                        title: Type Investissement
                      type_operation:
                        anyOf:
                          - type: string
                          - type: 'null'
                        default: null
                        title: Type Operation
                      classe_actif:
                        anyOf:
                          - type: string
                          - type: 'null'
                        default: null
                        title: Classe Actif
                      statut_interne:
                        anyOf:
                          - type: string
                          - type: 'null'
                        default: null
                        title: Statut Interne
                      statut_operationnel:
                        anyOf:
                          - items:
                              type: string
                            type: array
                          - type: 'null'
                        default: null
                        title: Statut Operationnel
                      sous_classe_actif:
                        anyOf:
                          - type: string
                          - type: 'null'
                        default: null
                        title: Sous Classe Actif
                      data:
                        additionalProperties: true
                        title: Data
                        type: object
                      kpi_snapshot:
                        anyOf:
                          - additionalProperties: true
                            type: object
                          - type: 'null'
                        default: null
                        title: Kpi Snapshot
                      created_at:
                        format: date-time
                        title: Created At
                        type: string
                      updated_at:
                        format: date-time
                        title: Updated At
                        type: string
                    required:
                      - id
                      - name
                      - status
                      - created_at
                      - updated_at
                    title: ExternalOperationResourceResponse
                    type: object
                  taxonomy_additions:
                    items:
                      properties:
                        parent_code:
                          anyOf:
                            - enum:
                                - due_diligence
                                - en_cours
                                - en_recouvrement
                                - termine
                              type: string
                            - type: 'null'
                          default: null
                          title: Parent Code
                        code:
                          title: Code
                          type: string
                        dimension:
                          enum:
                            - operation_status
                            - investment_type
                            - operation_type
                            - asset_class
                            - internal_status
                            - operational_status
                            - follow_up_category
                          title: Dimension
                          type: string
                        display_label:
                          title: Display Label
                          type: string
                        source_kind:
                          enum:
                            - marko
                            - partner
                            - entity
                          title: Source Kind
                          type: string
                        source_display_name:
                          title: Source Display Name
                          type: string
                        is_visible:
                          title: Is Visible
                          type: boolean
                        is_active:
                          title: Is Active
                          type: boolean
                        position:
                          title: Position
                          type: integer
                        usage_count:
                          default: 0
                          title: Usage Count
                          type: integer
                        label_editable:
                          title: Label Editable
                          type: boolean
                        canonical_code:
                          anyOf:
                            - type: string
                            - type: 'null'
                          default: null
                          title: Canonical Code
                        icon_key:
                          anyOf:
                            - enum:
                                - tag
                                - briefcase
                                - building
                                - landmark
                                - home
                                - map
                                - layers
                                - shield
                                - trending-up
                                - calendar
                                - circle-check
                                - triangle-alert
                              type: string
                            - type: 'null'
                          default: null
                          title: Icon Key
                      required:
                        - code
                        - dimension
                        - display_label
                        - source_kind
                        - source_display_name
                        - is_visible
                        - is_active
                        - position
                        - label_editable
                      title: EntityTaxonomyOptionResponse
                      type: object
                    title: Taxonomy Additions
                    type: array
                  request_id:
                    title: Request Id
                    type: string
                required:
                  - external_id
                  - marko_id
                  - outcome
                  - resource
                  - request_id
                title: ExternalOperationSyncUpsertResponse
                type: object
              example:
                external_id: CF-OP-001
                marko_id: 44444444-4444-4444-4444-444444444444
                outcome: updated
                resource:
                  id: 44444444-4444-4444-4444-444444444444
                  spv_id: null
                  lead_operateur_id: null
                  name: Clubfunding Demo Deal - Mise à jour
                  status: custom__a3e08c7bde__projet_emis
                  type_investissement: dette_senior
                  type_operation: acquisition_detention
                  classe_actif: residentiel
                  statut_interne: analyse
                  statut_operationnel:
                    - commercialisation
                  sous_classe_actif: residentiel_coliving
                  data:
                    adresse: 14 rue de la Paix, Paris
                  created_at: '2026-08-22T08:00:00Z'
                  updated_at: '2026-08-22T09:30:00Z'
                taxonomy_additions: []
                request_id: req_cf_operation_update
          x-marko-request-example:
            name: Clubfunding Demo Deal - Mise à jour
            status: custom__a3e08c7bde__projet_emis
            type_investissement: dette_senior
            type_operation: acquisition_detention
            classe_actif: residentiel
            statut_interne: analyse
            statut_operationnel:
              - commercialisation
            sous_classe_actif: residentiel_coliving
            data:
              adresse: 14 rue de la Paix, Paris
            kpi_snapshot:
              date_reference: '2026-07-31'
              crd_total: 2400000
              valeur_venale: 3500000
              ltv: 0.6857
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                properties:
                  external_id:
                    title: External Id
                    type: string
                  marko_id:
                    format: uuid
                    title: Marko Id
                    type: string
                  outcome:
                    enum:
                      - created
                      - updated
                      - noop
                      - restored
                      - bound
                    title: Outcome
                    type: string
                  resource:
                    properties:
                      id:
                        format: uuid
                        title: Id
                        type: string
                      spv_id:
                        anyOf:
                          - type: string
                            format: uuid
                          - type: 'null'
                        default: null
                        title: Spv Id
                      lead_operateur_id:
                        anyOf:
                          - type: string
                            format: uuid
                          - type: 'null'
                        default: null
                        title: Lead Operateur Id
                      name:
                        title: Name
                        type: string
                      status:
                        title: Status
                        type: string
                      type_investissement:
                        anyOf:
                          - type: string
                          - type: 'null'
                        default: null
                        title: Type Investissement
                      type_operation:
                        anyOf:
                          - type: string
                          - type: 'null'
                        default: null
                        title: Type Operation
                      classe_actif:
                        anyOf:
                          - type: string
                          - type: 'null'
                        default: null
                        title: Classe Actif
                      statut_interne:
                        anyOf:
                          - type: string
                          - type: 'null'
                        default: null
                        title: Statut Interne
                      statut_operationnel:
                        anyOf:
                          - items:
                              type: string
                            type: array
                          - type: 'null'
                        default: null
                        title: Statut Operationnel
                      sous_classe_actif:
                        anyOf:
                          - type: string
                          - type: 'null'
                        default: null
                        title: Sous Classe Actif
                      data:
                        additionalProperties: true
                        title: Data
                        type: object
                      kpi_snapshot:
                        anyOf:
                          - additionalProperties: true
                            type: object
                          - type: 'null'
                        default: null
                        title: Kpi Snapshot
                      created_at:
                        format: date-time
                        title: Created At
                        type: string
                      updated_at:
                        format: date-time
                        title: Updated At
                        type: string
                    required:
                      - id
                      - name
                      - status
                      - created_at
                      - updated_at
                    title: ExternalOperationResourceResponse
                    type: object
                  taxonomy_additions:
                    items:
                      properties:
                        parent_code:
                          anyOf:
                            - enum:
                                - due_diligence
                                - en_cours
                                - en_recouvrement
                                - termine
                              type: string
                            - type: 'null'
                          default: null
                          title: Parent Code
                        code:
                          title: Code
                          type: string
                        dimension:
                          enum:
                            - operation_status
                            - investment_type
                            - operation_type
                            - asset_class
                            - internal_status
                            - operational_status
                            - follow_up_category
                          title: Dimension
                          type: string
                        display_label:
                          title: Display Label
                          type: string
                        source_kind:
                          enum:
                            - marko
                            - partner
                            - entity
                          title: Source Kind
                          type: string
                        source_display_name:
                          title: Source Display Name
                          type: string
                        is_visible:
                          title: Is Visible
                          type: boolean
                        is_active:
                          title: Is Active
                          type: boolean
                        position:
                          title: Position
                          type: integer
                        usage_count:
                          default: 0
                          title: Usage Count
                          type: integer
                        label_editable:
                          title: Label Editable
                          type: boolean
                        canonical_code:
                          anyOf:
                            - type: string
                            - type: 'null'
                          default: null
                          title: Canonical Code
                        icon_key:
                          anyOf:
                            - enum:
                                - tag
                                - briefcase
                                - building
                                - landmark
                                - home
                                - map
                                - layers
                                - shield
                                - trending-up
                                - calendar
                                - circle-check
                                - triangle-alert
                              type: string
                            - type: 'null'
                          default: null
                          title: Icon Key
                      required:
                        - code
                        - dimension
                        - display_label
                        - source_kind
                        - source_display_name
                        - is_visible
                        - is_active
                        - position
                        - label_editable
                      title: EntityTaxonomyOptionResponse
                      type: object
                    title: Taxonomy Additions
                    type: array
                  request_id:
                    title: Request Id
                    type: string
                required:
                  - external_id
                  - marko_id
                  - outcome
                  - resource
                  - request_id
                title: ExternalOperationSyncUpsertResponse
                type: object
              example:
                external_id: CF-OP-001
                marko_id: 44444444-4444-4444-4444-444444444444
                outcome: created
                resource:
                  id: 44444444-4444-4444-4444-444444444444
                  spv_id: null
                  lead_operateur_id: null
                  name: Clubfunding Demo Deal
                  status: custom__a3e08c7bde__projet_emis
                  type_investissement: dette_senior
                  type_operation: acquisition_detention
                  classe_actif: residentiel
                  statut_interne: analyse
                  statut_operationnel:
                    - commercialisation
                  sous_classe_actif: residentiel_coliving
                  data:
                    adresse: 12 rue de la Paix, Paris
                  created_at: '2026-08-22T08:00:00Z'
                  updated_at: '2026-08-22T08:00:00Z'
                taxonomy_additions:
                  - code: custom__a3e08c7bde__projet_emis
                    dimension: operation_status
                    display_label: Projet émis
                    source_kind: partner
                    source_display_name: ClubFunding
                    is_visible: true
                    is_active: true
                    position: 10000
                    usage_count: 0
                    label_editable: true
                    canonical_code: null
                request_id: req_cf_operation_upsert
        '400':
          description: Invalid Idempotency-Key header
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                type: about:blank
                title: Bad Request
                status: 400
                detail: >-
                  Idempotency-Key must contain at most 255 visible ASCII
                  characters without spaces.
                request_id: req_example_partner_call
        '401':
          description: Authentication required
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                type: about:blank
                title: Unauthorized
                status: 401
                detail: A valid bearer token is required.
                request_id: req_example_partner_call
        '403':
          description: Scope, route or IP restriction
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                type: about:blank
                title: Forbidden
                status: 403
                detail: The API key does not allow this operation.
                request_id: req_example_partner_call
        '404':
          description: Existing MARKO operation or related resource not found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                type: about:blank
                title: Not Found
                status: 404
                detail: Existing MARKO operation or related resource not found
                request_id: req_example_partner_call
        '409':
          description: Idempotency or write target conflict
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                type: about:blank
                title: Conflict
                status: 409
                detail: >-
                  The idempotency key payload, external reference, target, or
                  source conflicts with an existing write.
                request_id: req_example_partner_call
        '422':
          description: Validation failed
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                type: about:blank
                title: Unprocessable Content
                status: 422
                detail: The request payload or parameters are invalid.
                request_id: req_example_partner_call
        '428':
          description: Required Idempotency-Key header is missing
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                type: about:blank
                title: Precondition Required
                status: 428
                detail: The Idempotency-Key header is required.
                request_id: req_example_partner_call
        '429':
          description: Rate limit or progressive ban
          headers:
            Retry-After:
              description: Cooldown in seconds before retrying the request.
              schema:
                type: string
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                type: about:blank
                title: Too Many Requests
                status: 429
                detail: The request rate limit was exceeded.
                request_id: req_example_partner_call
        '500':
          description: Unexpected server error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
              example:
                type: about:blank
                title: Internal Server Error
                status: 500
                detail: An unexpected server error occurred.
                request_id: req_example_partner_call
      deprecated: false
      security:
        - BearerAuth: []
components:
  schemas:
    ProblemDetails:
      type: object
      required:
        - title
        - status
        - detail
      properties:
        type:
          type: string
          default: about:blank
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
        request_id:
          type: string
        scope:
          type: string
        route_id:
          type: string
        reason_code:
          type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: MARKO short-lived bearer
      description: >-
        Use the `access_token` returned by `POST /v1/auth/token`. Do not send
        the raw API secret on business endpoints.

````