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

# Sync a card save

> Call after `stripe.confirmSetup()` resolves. Reads the SetupIntent from Stripe (never trusts the client) and, when it `succeeded`, makes the card the workspace's saved card right away, replacing the previous one. Not succeeded yet → `saved: false`. Idempotent. Never reads a body. Owner only.

**Requires a tenant-scoped key** — a workspace key, or an account key with `x-workspace-id`.



## OpenAPI

````yaml openapi.json POST /v1/billing/card/setup-intent/{id}/sync
openapi: 3.1.0
info:
  title: Pilot Status API
  version: 1.0.0
  license:
    name: Pilot Status Terms of Service
    url: https://pilotstatus.com.br/terms
  description: >-
    Public REST API for Pilot Status. Authenticate with the `x-api-key: ps_...`
    header (or `x-api-key-id`). Base URL: https://pilotstatus.com.br
servers:
  - url: https://pilotstatus.com.br
security:
  - apiKey: []
  - apiKeyId: []
paths:
  /v1/billing/card/setup-intent/{id}/sync:
    post:
      tags:
        - Billing
      summary: Sync a card save
      description: >-
        Call after `stripe.confirmSetup()` resolves. Reads the SetupIntent from
        Stripe (never trusts the client) and, when it `succeeded`, makes the
        card the workspace's saved card right away, replacing the previous one.
        Not succeeded yet → `saved: false`. Idempotent. Never reads a body.
        Owner only.


        **Requires a tenant-scoped key** — a workspace key, or an account key
        with `x-workspace-id`.
      operationId: post_billing_card_setup_intent_id_sync
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: The `setupIntentId` (`seti_…`).
          example: seti_1QabcDEF
        - name: x-workspace-id
          in: header
          required: false
          schema:
            type: string
          description: >-
            Only with an account key (`ps_account_`): the workspace to act on,
            from `GET /v1/workspaces`. Without it an account key gets `400
            WORKSPACE_ID_REQUIRED`.
          example: cmh2a9z8y0002ws8example1q
      responses:
        '200':
          description: Result
          content:
            application/json:
              example:
                setupIntentId: seti_1QabcDEF
                status: succeeded
                saved: true
                card:
                  brand: visa
                  last4: '4242'
                  expMonth: 12
                  expYear: 2030
        '400':
          description: The id is not a `seti_…`
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  The id must be a Stripe SetupIntent id (seti_…). | O id deve
                  ser o id de um SetupIntent do Stripe (seti_…).
                code: INVALID_SETUP_INTENT_ID
        '401':
          description: Missing, invalid or revoked API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Invalid API key
        '403':
          description: >-
            Number-scoped key (`NUMBER_SCOPE_NOT_ALLOWED`), the user's role does
            not allow it (`PERMISSION_DENIED`), or an account key outside its
            workspaces (`WORKSPACE_MEMBERSHIP_REQUIRED`)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: This endpoint requires a tenant-scoped API key
                code: NUMBER_SCOPE_NOT_ALLOWED
        '404':
          description: Not an intent created for this workspace
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  Setup intent not found for this workspace. | Setup intent não
                  encontrado neste workspace.
                code: SETUP_INTENT_NOT_FOUND
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Your ps_ API key
    apiKeyId:
      type: apiKey
      in: header
      name: x-api-key-id
      description: API key id (alternative to x-api-key)

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.