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

# Müşteri tanı formu oluşturma

> Müşteri tanı (KYC) formatında yeni kayıt oluşturur: onay bekleyen bir form yazılır (isApproval daima false doğar; API doğrudan onaylı müşteri yaratmaz; onay panel akışında tamamlanır). Aynı idNo ile onay bekleyen form varsa 409 CONFLICT döner ve details içinde existingId verilir. Salt okunur alanlar (isApproval, masakStatus, companiesId vb.) gönderilirse 400 döner. idType=company iken companyDocuments (taxDoc, activeDoc, registryDoc, signDoc) kabul edilir: Accord ile aynı doğrulama (PDF/JPEG/PNG, belge başına en fazla 2 MiB, uzantı ve dosya imzası kontrolü) uygulanır, içerik güvenli geçici depoya yazılır ve panel onayında kimlik servisine taşınır. Kimlik/pasaport görselleri için POST /v1/customers/identity-documents kullanılır.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/customers/verifications
openapi: 3.0.3
info:
  title: Sarraf API v1
  version: 1.0.0
  description: >-
    Sarraf sürümlü dış API yüzeyi. Bu sürüm salt okunurdur; e-ticaret siteleri
    ve muhasebe programları için mevcut kayıtların okunmasını sağlar. Kimlik
    doğrulama mevcut dış API ile aynıdır: HTTP Basic,
    base64(apiUserId:secretKey). Tüm yanıtlar sabit zarf formatındadır: başarılı
    yanıtta success/data/meta, hatalı yanıtta
    success/error{code,message,details}/traceId. Her yanıtta x-request-id
    başlığı döner ve traceId ile aynıdır.
servers:
  - url: https://api.sarraf.pro
    description: Canlı ortam
security:
  - BasicAuth: []
tags:
  - name: Customers
    description: >-
      Cari hesaplar ve uyum — listeleme, detay, müşteri tanı oluşturma,
      kayıt/sicil sorgusu, tanı formları, kimlik belgeleri, yaptırım sorguları
      ve sicil geçmişi
    x-group: Müşteriler
  - name: Bank accounts
    description: Banka hesapları, bakiyeler ve sorgu tetikleme
    x-group: Banka
  - name: Bank transactions
    description: Gelen/giden banka hareketleri — detayda gömülü MASAK özeti
    x-group: Banka
  - name: Invoices
    description: Sistem üzerinden kesilen faturalar ve kalem şablonları
    x-group: Faturalar
  - name: Expenses
    description: Gider pusulası kayıtları
    x-group: Giderler
paths:
  /v1/customers/verifications:
    post:
      tags:
        - Customers
      summary: Müşteri tanı formu oluşturma
      description: >-
        Müşteri tanı (KYC) formatında yeni kayıt oluşturur: onay bekleyen bir
        form yazılır (isApproval daima false doğar; API doğrudan onaylı müşteri
        yaratmaz; onay panel akışında tamamlanır). Aynı idNo ile onay bekleyen
        form varsa 409 CONFLICT döner ve details içinde existingId verilir. Salt
        okunur alanlar (isApproval, masakStatus, companiesId vb.) gönderilirse
        400 döner. idType=company iken companyDocuments (taxDoc, activeDoc,
        registryDoc, signDoc) kabul edilir: Accord ile aynı doğrulama
        (PDF/JPEG/PNG, belge başına en fazla 2 MiB, uzantı ve dosya imzası
        kontrolü) uygulanır, içerik güvenli geçici depoya yazılır ve panel
        onayında kimlik servisine taşınır. Kimlik/pasaport görselleri için POST
        /v1/customers/identity-documents kullanılır.
      operationId: createCustomerVerification
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VerificationCreateRequest'
      responses:
        '201':
          description: >-
            Müşteri tanı formu oluşturuldu; durum takibi GET
            /v1/customers/verifications/{id} ile yapılır.
          headers:
            x-request-id:
              description: İstek kimliği; yanıt gövdesindeki meta.requestId ile aynıdır.
              schema:
                type: string
                format: uuid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VerificationCreateResponse'
        '400':
          $ref: '#/components/responses/ValidationFailed'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          description: >-
            Aynı idNo ile onay bekleyen form zaten var (details[0].existingId
            mevcut kaydı gösterir).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    VerificationCreateRequest:
      type: object
      description: >-
        Müşteri tanı formu gövdesi — data zarfı zorunludur. Salt okunur alanlar
        (isApproval, isSigned, isDeleted, masakStatus, companiesId, userId,
        approval*, requirementsSnapshot, printSnapshot, contractVersion, uuid
        vb.) ve bilinmeyen alanlar 400 döner.
      properties:
        data:
          type: object
          properties:
            idNo:
              type: string
              description: TCKN / VKN / belge numarası (zorunlu).
            nameSurname:
              type: string
              description: Ad soyad / ünvan (zorunlu).
            idType:
              type: string
              enum:
                - person
                - company
              default: person
            idCardType:
              type: string
              enum:
                - idCard
                - passport
                - dlCard
                - other
              default: idCard
            nationality:
              type: string
              default: TR
            birthplace:
              type: string
            birthday:
              type: string
            phone:
              type: string
            phone2:
              type: string
            email:
              type: string
            iban:
              type: string
            taxOffice:
              type: string
            registryNo:
              type: string
            activityName:
              type: string
            naceCode:
              type: string
            countriesCode:
              type: string
            countries:
              type: string
            statesCode:
              type: string
            states:
              type: string
            cities:
              type: string
            address:
              type: string
            motherName:
              type: string
            fatherName:
              type: string
            jobName:
              type: string
            isAbroad:
              type: boolean
            onlyInvoice:
              type: boolean
              description: Yalnız fatura kaydı olarak oluştur.
            customerRelation:
              $ref: '#/components/schemas/CustomerRelation'
            companyDocuments:
              $ref: '#/components/schemas/CompanyDocumentsInput'
          required:
            - idNo
            - nameSurname
      required:
        - data
    VerificationCreateResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          $ref: '#/components/schemas/VerificationListItem'
        meta:
          $ref: '#/components/schemas/MetaBase'
      required:
        - success
        - data
        - meta
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          $ref: '#/components/schemas/ErrorBody'
        traceId:
          type: string
          format: uuid
          description: x-request-id başlığı ile aynı değer.
      required:
        - success
        - error
        - traceId
    CustomerRelation:
      type: object
      description: Kurumsal formda temsilci/ortak/gerçek faydalanıcı bilgisi.
      properties:
        types:
          type: string
          enum:
            - representative
            - shareholder
            - beneficialOwner
        nameSurname:
          type: string
          nullable: true
        nationality:
          type: string
          nullable: true
        idCardType:
          type: string
          nullable: true
        idNo:
          type: string
          nullable: true
        birthplace:
          type: string
          nullable: true
        birthday:
          type: string
          nullable: true
        phone:
          type: string
          nullable: true
        email:
          type: string
          nullable: true
        beneficialDescription:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        authorityStartDate:
          type: string
          format: date-time
          nullable: true
        authorityEndDate:
          type: string
          format: date-time
          nullable: true
        isPrimary:
          type: boolean
          nullable: true
    CompanyDocumentsInput:
      type: object
      description: >-
        Kurumsal belge seti; yalnız idType=company iken kabul edilir. Bilinmeyen
        belge türü 400 döner.
      properties:
        taxDoc:
          $ref: '#/components/schemas/CompanyDocumentInput'
        activeDoc:
          $ref: '#/components/schemas/CompanyDocumentInput'
        registryDoc:
          $ref: '#/components/schemas/CompanyDocumentInput'
        signDoc:
          $ref: '#/components/schemas/CompanyDocumentInput'
    VerificationListItem:
      type: object
      properties:
        id:
          type: string
          description: Kayıt kimliği (ObjectId).
        idNo:
          type: string
          description: TCKN / VKN / belge numarası.
        idType:
          type: string
          enum:
            - person
            - company
        idCardType:
          type: string
          enum:
            - idCard
            - passport
            - dlCard
            - other
        nameSurname:
          type: string
        phone:
          type: string
          nullable: true
        email:
          type: string
          nullable: true
        nationality:
          type: string
          example: TR
        countries:
          type: string
          nullable: true
        states:
          type: string
          nullable: true
        cities:
          type: string
          nullable: true
        masakStatus:
          type: integer
          enum:
            - 0
            - 1
            - 2
          description: 0 sorgulanmadı, 1 sorun yok, 2 sorunlu.
        isApproval:
          type: boolean
          description: Form onaylandı mı.
        isSigned:
          type: boolean
          description: Form imzalı mı.
        onlyInvoice:
          type: boolean
          nullable: true
          description: Yalnız fatura kaydı mı.
        contractVersion:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    MetaBase:
      type: object
      properties:
        requestId:
          type: string
          format: uuid
        timestamp:
          type: string
          format: date-time
      required:
        - requestId
        - timestamp
    ErrorBody:
      type: object
      properties:
        code:
          type: string
          enum:
            - VALIDATION_FAILED
            - AUTH_INVALID_CREDENTIALS
            - AUTH_FORBIDDEN
            - RESOURCE_NOT_FOUND
            - CONFLICT
            - UPSTREAM_ERROR
            - INTERNAL_ERROR
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetail'
      required:
        - code
        - message
        - details
    CompanyDocumentInput:
      type: object
      description: >-
        Kurumsal belge — Accord ile aynı doğrulama: PDF/JPEG/PNG, belge başına
        en fazla 2 MiB, dosya uzantısı ve içerik imzası MIME türüyle eşleşmeli.
      properties:
        fileName:
          type: string
          description: Dosya adı (zorunlu); uzantısı MIME türüyle eşleşmeli.
        mimeType:
          type: string
          enum:
            - application/pdf
            - image/jpeg
            - image/png
        content:
          type: string
          description: Base64 içerik veya Data URL (zorunlu).
      required:
        - fileName
        - mimeType
        - content
    ErrorDetail:
      type: object
      properties:
        field:
          type: string
        rule:
          type: string
  responses:
    ValidationFailed:
      description: Doğrulama hatası (geçersiz parametre).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Kimlik doğrulama başarısız.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalError:
      description: Beklenmeyen sunucu hatası.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
      description: >-
        Kullanıcı adı apiUserId, parola secretKey. Authorization: Basic
        base64(apiUserId:secretKey)

````