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

# Create Batch Cache

> Creates multiple caches in a single request. Each item in the array follows the same schema as the single create cache endpoint. Caches are created independently; if one fails, the others may still succeed.

The response contains a list of results, one per requested cache, each indicating success or failure. On success, the created cache object is included. On failure, the error message is provided.

This is useful when enabling caching for multiple tables at once (e.g. during initial project setup).

<span style={{display: "flex", gap: "10px", flexDirection: "row", alignItems: "center"}}>
  <img src="https://cdn.peaka.com/badges/partner-api-key-badge.png" />

  <img src="https://cdn.peaka.com/badges/project-api-key-badge.png" />
</span>


## OpenAPI

````yaml post /data/projects/{projectId}/cache/batch
openapi: 3.0.1
info:
  title: Peaka Gateway API
  description: Peaka Gateway API Documentation
  version: '1.0'
servers:
  - url: https://partner.peaka.studio/api/v1
    description: Default Server URL (US Zone)
  - url: https://partner.eu.peaka.studio/api/v1
    description: EU Zone
security:
  - bearerAuth: []
paths:
  /data/projects/{projectId}/cache/batch:
    post:
      tags:
        - Data -- Cache
      summary: Create Batch Cache
      description: >-
        Creates multiple caches in a single request. Each item in the array
        follows the same schema as the single create cache endpoint. Caches are
        created independently; if one fails, the others may still succeed.


        The response contains a list of results, one per requested cache, each
        indicating success or failure. On success, the created cache object is
        included. On failure, the error message is provided.


        This is useful when enabling caching for multiple tables at once (e.g.
        during initial project setup).
      operationId: createBatchCache
      parameters:
        - name: projectId
          in: path
          description: The unique identifier of the project that owns the data sources
          required: true
          schema:
            type: string
          example: mtKDhe1U
      requestBody:
        description: >-
          Array of cache creation requests. Each element specifies a table to
          cache with optional sync schedules.
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/CacheRequest'
            examples:
              Create Multiple Caches:
                description: >-
                  Creates three caches: one without schedules, one with
                  incremental only, and one with both full refresh and
                  incremental schedules.
                value:
                  - catalogId: '627249916703408649'
                    schemaName: payment
                    tableName: customers
                  - catalogId: '627249916703408649'
                    schemaName: payment
                    tableName: charges
                    incrementalCacheSchedule:
                      type: BASIC
                      expression: PT6H
                  - catalogId: '627249916703408649'
                    schemaName: payment
                    tableName: invoices
                    fullRefreshCacheSchedule:
                      type: BASIC
                      expression: PT24H
                    incrementalCacheSchedule:
                      type: BASIC
                      expression: PT6H
        required: true
      responses:
        '200':
          description: >-
            Batch processing completed. Each entry in the response array
            indicates whether that specific cache was created successfully or
            failed.
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CacheCreateStatus'
components:
  schemas:
    CacheRequest:
      type: object
      properties:
        catalogId:
          type: string
          description: The ID of the catalog for the cache request.
        schemaName:
          type: string
          description: The name of the schema for the cache request.
        tableName:
          type: string
          description: The name of the table for the cache request.
        incrementalCacheSchedule:
          $ref: '#/components/schemas/Schedule'
        fullRefreshCacheSchedule:
          $ref: '#/components/schemas/Schedule'
      description: |-
        This class represents a request to cache data.
         It contains the catalog ID, schema name, table name, and schedule of the cache request.
    CacheCreateStatus:
      type: object
      properties:
        success:
          type: boolean
        error:
          type: string
        cache:
          $ref: '#/components/schemas/Cache'
    Schedule:
      type: object
      properties:
        type:
          type: string
          description: The type of the schedule. BASIC or NONE.
        expression:
          type: string
          description: |-
            The expression of the schedule.
             Valid if the type is other than NONE.
             For BASIC, the expression is a duration in ISO-8601 format.
             "PT15M"     -- parses as "15 minutes" (where a minute is 60 seconds)
             "PT10H"     -- parses as "10 hours" (where an hour is 3600 seconds)
             "P2D"       -- parses as "2 days" (where a day is 24 hours or 86400 seconds)
      description: |-
        This class represents a schedule for a cache request.
         It contains the type and expression of the schedule.
    Cache:
      type: object
      properties:
        id:
          type: string
          description: The ID of the cache.
        catalogId:
          type: string
          description: The ID of the catalog for the cache request.
        schemaName:
          type: string
          description: The name of the schema for the cache request.
        tableName:
          type: string
          description: The name of the table for the cache request.
        incrementalCacheSchedule:
          $ref: '#/components/schemas/Schedule'
        fullRefreshCacheSchedule:
          $ref: '#/components/schemas/Schedule'
        appId:
          type: string
          writeOnly: true
        projectId:
          type: string
          description: The ID of the project for the cache request.
  securitySchemes:
    bearerAuth:
      type: http
      description: >-
        Use the Authorization header with the value 'Bearer <apiKey>' to
        authenticate. Partner API Keys have full access; Project API Keys are
        limited to their project scope. Learn more:
        https://docs.peaka.com/api-reference/authentication
      scheme: bearer
      bearerFormat: Api Key

````