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

# Sync Forms

> Queues a sync of the connected EMR's form definitions into the Cobalt cache.

Queues a background sync that scrapes the connected EMR's form definitions and upserts them into the Cobalt cache. The request returns immediately with `202 Accepted`; a `forms.synced` webhook is sent when the sync completes. The cached results are then served by [`GET /v1/forms`](/api-reference/forms/get) and [`GET /v1/forms/{id}`](/api-reference/forms/get-by-id).

A daily scheduler drives the routine cadence — use this endpoint for on-demand or onboarding refreshes.

<Note>
  Forms are currently supported for **Credible**.
</Note>

### Concurrency

Only one sync may run per account at a time. If a sync is already in progress, the request returns `409` with the id of the in-flight job so you can back off rather than queueing a duplicate.

### Request Parameters

#### Optional Fields

* **callback\_urls** (array of strings, optional): URLs to receive the `forms.synced` webhook, in addition to your account webhook.

### Example Request

```bash theme={null}
curl -X POST https://api.usecobalt.com/v1/forms/fetch \
-H 'Content-Type: application/json' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-H 'access_token: 493JKLHIU98789hLKH9HHJH' \
-d '{}'
```

### Example Response

```json theme={null}
{
    "success": true,
    "status": "queued",
    "message": "Forms sync started. A forms.synced webhook will be sent when it completes.",
    "job_execution_id": "123e4567e89b12d3a456426614174000"
}
```

### Error Responses

#### Sync Already Running

```json theme={null}
{
    "success": false,
    "status": "running",
    "message": "A forms sync is already in progress for this account. Please try again once it completes.",
    "job_execution_id": "123e4567e89b12d3a456426614174000"
}
```

Returned with `409`. Wait for the in-flight sync (identified by `job_execution_id`) to finish before retrying.

#### Unsupported EMR

```json theme={null}
{
    "success": false,
    "message": "Forms sync is not supported for [EMR Name]."
}
```

#### User Not Found

```json theme={null}
{
    "success": false,
    "message": "User not found."
}
```

This indicates an issue with your access token.

### Webhook Notification

When the sync finishes, we send a `forms.synced` webhook to your registered endpoint. Read the refreshed forms with [`GET /v1/forms`](/api-reference/forms/get).


## OpenAPI

````yaml POST /forms/fetch
openapi: 3.0.0
info:
  title: Cobalt API
  version: 1.0.1
  description: API for interacting with Cobalt's EHR integration services
servers:
  - url: https://api.usecobalt.com/v1
security:
  - ClientCredentials: []
    ClientSecret: []
    AccessToken: []
paths:
  /forms/fetch:
    post:
      summary: Sync Forms
      description: >-
        Queues a background sync of the connected EMR's form definitions into
        the Cobalt cache. Returns 202 immediately; a forms.synced webhook is
        sent on completion. Only one sync may run per account at a time (a
        second request returns 409). Currently supported for Credible.
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                callback_urls:
                  type: array
                  items:
                    type: string
                  description: >-
                    URLs to receive the forms.synced webhook, in addition to the
                    account webhook.
      responses:
        '202':
          description: Forms sync queued; results delivered by webhook
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  status:
                    type: string
                    example: queued
                  message:
                    type: string
                    example: >-
                      Forms sync started. A forms.synced webhook will be sent
                      when it completes.
                  job_execution_id:
                    type: string
                    description: Job execution identifier for the queued sync.
        '400':
          description: Bad request - validation error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    example: Invalid callback_urls.
        '404':
          description: User not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    example: User not found.
        '409':
          description: A forms sync is already in progress for this account
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  status:
                    type: string
                    example: running
                  message:
                    type: string
                    example: >-
                      A forms sync is already in progress for this account.
                      Please try again once it completes.
                  job_execution_id:
                    type: string
                    description: Id of the in-flight sync job.
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    example: Unable to start forms sync at this time.
components:
  securitySchemes:
    ClientCredentials:
      type: apiKey
      in: header
      name: client_id
    ClientSecret:
      type: apiKey
      in: header
      name: client_secret
    AccessToken:
      type: apiKey
      in: header
      name: access_token

````