# Access level ver

> Son kullanıcınıza işlem bilgisi sağlamadan access level verir. Bu, referanslar için bonuslarınız veya ürünlerinizle ilgili diğer etkinlikleriniz varsa işe yarar. Bu yöntemle sağlanan access level, analizlerinize yansımaz. Yalnızca webhook entegrasyonuna gönderilir ve yalnızca bu durumda Etkinlik Akışı'nda görünür.

## OpenAPI

```yaml
/api-specs/adapty-api.yaml post /api/v2/server-side-api/purchase/profile/grant/access-level/
openapi: 3.1.0
info:
  title: Adapty sunucu taraflı API
  version: 1.0.0
servers:
  - url: https://api.adapty.io
    description: Üretim sunucusu
paths:
  /api/v2/server-side-api/purchase/profile/grant/access-level/:
    post:
      summary: Access level ver
      description: Son kullanıcınıza işlem bilgisi sağlamadan access level verir. Bu, referanslar için bonuslarınız veya ürünlerinizle ilgili diğer etkinlikleriniz varsa işe yarar. Bu yöntemle sağlanan access level, analizlerinize yansımaz. Yalnızca webhook entegrasyonuna gönderilir ve yalnızca bu durumda Etkinlik Akışı'nda görünür.
      operationId: grantAccessLevel
      tags:
        - Purchase
      security:
        - apikeyAuth: []
      parameters:
        - name: adapty-customer-user-id
          in: header
          required: false
          schema:
            type: string
          description: Sisteminizdeki müşterinin benzersiz kimliği. `adapty-customer-user-id` veya `adapty-profile-id`'den biri zorunludur.
        - name: adapty-profile-id
          in: header
          required: false
          schema:
            type: string
          description: Sisteminizdeki profilin benzersiz kimliği. Anonim profillerle çalışıyorsanız en iyi seçeneğinizdir. `adapty-customer-user-id` veya `adapty-profile-id`'den biri zorunludur.
      responses:
        "200":
          description: Access level başarıyla verildi
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProfileResponse"
        "400":
          description: Hatalı istek
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "401":
          description: Yetkisiz
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "404":
          description: Profil bulunamadı
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "500":
          description: Sunucu içi hata
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/GrantAccessRequest"
            examples:
              immediate_grant:
                summary: Access level'i hemen ver
                value:
                  access_level_id: premium
              scheduled_grant:
                summary: Başlangıç ve bitiş tarihleriyle access level ver
                value:
                  access_level_id: premium
                  starts_at: "2024-01-01T00:00:00Z"
                  expires_at: "2024-12-31T23:59:59Z"
              lifetime_grant:
                summary: Süresiz erişim ver
                value:
                  access_level_id: premium
                  starts_at: "2024-01-01T00:00:00Z"
components:
  schemas:
    ProfileResponse:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Profile"
      required:
        - data
    ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              source:
                type: string
                nullable: true
                description: Hatanın kaynağı
              errors:
                type: array
                items:
                  type: string
                description: Hata mesajları dizisi
        error_code:
          type: string
          description: Kısa hata adı
        status_code:
          type: integer
          description: HTTP durum kodu
      required:
        - errors
        - error_code
        - status_code
    GrantAccessRequest:
      type: object
      properties:
        access_level_id:
          type: string
          description: Access Levels sayfasında yapılandırılmış ücretli access level ID'si
        starts_at:
          type: string
          format: date-time
          nullable: true
          description: Access level'ın aktif olacağı tarih ve saat. Gelecekte bir tarih olabilir. Varsayılan değer null'dır.
        expires_at:
          type: string
          format: date-time
          nullable: true
          description: Access level'ın sona ereceği tarih ve saat. Geçmişte bir tarih olabilir ve süresiz erişim için null olabilir. Varsayılan değer null'dır.
      required:
        - access_level_id
    Profile:
      type: object
      properties:
        app_id:
          type: string
          format: uuid
          description: Uygulamanızın dahili kimliği
        profile_id:
          type: string
          format: uuid
          description: Adapty profil kimliği
        customer_user_id:
          type: string
          nullable: true
          description: Kullanıcınızın kendi sisteminizdeki kimliği
        total_revenue_usd:
          type: number
          format: float
          description: Profilde elde edilen toplam geliri USD cinsinden temsil eden ondalık sayı değeri
        segment_hash:
          type: string
          description: Dahili parametre
        timestamp:
          type: integer
          format: int64
          description: Yarış koşulunu çözmek için gereken milisaniye cinsinden yanıt süresi
        custom_attributes:
          type: array
          items:
            $ref: "#/components/schemas/CustomAttribute"
          description: Profile en fazla 30 özel öznitelik eklenebilir
        access_levels:
          type: array
          items:
            $ref: "#/components/schemas/AccessLevel"
          description: Access level nesnelerinin dizisi. Müşterinin herhangi bir access level'ı yoksa boş dizi döner
        subscriptions:
          type: array
          items:
            $ref: "#/components/schemas/Subscription"
          description: Abonelik nesnelerinin dizisi. Müşterinin herhangi bir aboneliği yoksa boş dizi döner
        non_subscriptions:
          type: array
          items:
            $ref: "#/components/schemas/NonSubscription"
          description: Tek seferlik satın alma nesnelerinin dizisi. Müşterinin herhangi bir satın alımı yoksa boş dizi döner
      required:
        - app_id
        - profile_id
        - customer_user_id
        - total_revenue_usd
        - segment_hash
        - timestamp
        - custom_attributes
        - access_levels
        - subscriptions
        - non_subscriptions
    CustomAttribute:
      type: object
      properties:
        key:
          type: string
          maxLength: 30
          description: Anahtar, 30 karakterden fazla olmayan bir dize olmalıdır. Yalnızca harflere, sayılara, tire, nokta ve alt çizgilere izin verilir
        value:
          oneOf:
            - type: string
            - type: number
          description: Özellik değeri 50 karakterden fazla olmamalıdır. Değer olarak yalnızca dizeler ve kayan noktalı sayılara izin verilir
      required:
        - key
        - value
    AccessLevel:
      type: object
      properties:
        access_level_id:
          type: string
          description: Access level tanımlayıcısı
        store:
          type: string
          description: Access level'ın satın alındığı mağaza
        store_product_id:
          type: string
          description: Mağazadaki ürün kimliği
        store_base_plan_id:
          type: string
          nullable: true
          description: Mağazadaki temel plan kimliği
        store_transaction_id:
          type: string
          description: Mağazadaki işlem kimliği
        store_original_transaction_id:
          type: string
          description: Mağazadaki orijinal işlem kimliği
        offer:
          allOf:
            - $ref: "#/components/schemas/OfferDTO"
          nullable: true
          description: Promosyon teklifi veya başlangıç teklifi uygulandıysa teklif ayrıntıları
        starts_at:
          type: string
          format: date-time
          nullable: true
          description: Access level'ın başladığı zaman
        purchased_at:
          type: string
          format: date-time
          description: Access level'ın satın alındığı zaman
        originally_purchased_at:
          type: string
          format: date-time
          description: Access level'ın ilk kez satın alındığı zaman
        expires_at:
          type: string
          format: date-time
          nullable: true
          description: Access level'ın sona erdiği zaman
        renewal_cancelled_at:
          type: string
          format: date-time
          nullable: true
          description: Yenilemenin iptal edildiği zaman
        billing_issue_detected_at:
          type: string
          format: date-time
          nullable: true
          description: Ödeme sorununun tespit edildiği zaman
        is_in_grace_period:
          type: boolean
          description: Access level'ın ek süre içinde olup olmadığı
        cancellation_reason:
          type: string
          nullable: true
          description: İptal gerekçesi
    Subscription:
      type: object
      properties:
        store:
          type: string
          description: Aboneliğin satın alındığı mağaza
        store_product_id:
          type: string
          description: Mağazadaki ürün kimliği
        store_base_plan_id:
          type: string
          nullable: true
          description: Mağazadaki temel plan kimliği
        store_transaction_id:
          type: string
          description: Mağazadaki işlem kimliği
        store_original_transaction_id:
          type: string
          description: Mağazadaki orijinal işlem kimliği
        offer:
          allOf:
            - $ref: "#/components/schemas/OfferDTO"
          nullable: true
          description: Bir promosyon teklifi veya başlangıç teklifi uygulandıysa teklif ayrıntıları
        environment:
          type: string
          description: Ortam (Sandbox, Production)
        purchased_at:
          type: string
          format: date-time
          description: Aboneliğin satın alındığı tarih
        originally_purchased_at:
          type: string
          format: date-time
          description: Aboneliğin ilk satın alındığı tarih
        expires_at:
          type: string
          format: date-time
          nullable: true
          description: Aboneliğin sona erdiği tarih
        renewal_cancelled_at:
          type: string
          format: date-time
          nullable: true
          description: Yenilemenin iptal edildiği tarih
        billing_issue_detected_at:
          type: string
          format: date-time
          nullable: true
          description: Faturalama sorununun tespit edildiği tarih
        is_in_grace_period:
          type: boolean
          description: Aboneliğin ek süre içinde olup olmadığı
        cancellation_reason:
          type: string
          nullable: true
          description: İptal nedeni
    NonSubscription:
      type: object
      properties:
        purchase_id:
          type: string
          format: uuid
          description: Benzersiz satın alma tanımlayıcısı
        store:
          type: string
          description: Satın almanın yapıldığı mağaza
        store_product_id:
          type: string
          description: Mağazadaki ürün kimliği
        store_base_plan_id:
          type: string
          nullable: true
          description: Mağazadaki temel plan kimliği
        store_transaction_id:
          type: string
          description: Mağazadaki işlem kimliği
        store_original_transaction_id:
          type: string
          description: Mağazadaki orijinal işlem kimliği
        purchased_at:
          type: string
          format: date-time
          description: Satın almanın yapıldığı zaman
        environment:
          type: string
          description: Ortam (Sandbox, Production)
        is_refund:
          type: boolean
          description: Bunun bir iade olup olmadığı
        is_consumable:
          type: boolean
          description: Bunun bir consumable satın alma olup olmadığı
    OfferDTO:
      type: object
      properties:
        category:
          type: string
          enum:
            - introductory
            - promotional
            - offer_code
            - win_back
          description: Teklif kategorisi
        type:
          type: string
          enum:
            - free_trial
            - pay_as_you_go
            - pay_up_front
          description: Teklif türü
        id:
          type: string
          nullable: true
          description: Teklif kimliği
      required:
        - category
        - type
  securitySchemes:
    apikeyAuth:
      type: apiKey
      name: Authorization
      in: header
      default: Api-Key {Your secret API key}
      description: |
        API istekleri, gizli API anahtarınız tarafından **Authorization** başlığı olarak
        `Api-Key {your_secret_api_key}` değeriyle doğrulanmalıdır; örneğin,
        `Api-Key secret_live_...`. Bu anahtarı Adapty Kontrol Paneli ->
        **Uygulama Ayarları** -> **Genel** sekmesi -> **API anahtarları** bölümünde bulabilirsiniz.
```
