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

# CredentialsResource: Manage Credentials and Baserow Proxies

> Use the Figranium Swift SDK to create, update, and delete credentials, plus proxy Baserow database and table lookups through stored credentials.

The `credentials` resource on the Figranium Swift SDK manages named credential sets used by tasks for external integrations. You can list, create, update, and delete credentials, and you can proxy Baserow requests through a stored credential to list databases and tables without handling tokens manually.

```swift main.swift theme={null}
import Figranium

let client = Figranium(apiKey: ProcessInfo.processInfo.environment["FIGRANIUM_API_KEY"])
```

## Methods

<AccordionGroup>
  <Accordion title="`list`">
    List all stored credentials.

    * **HTTP endpoint:** `GET /api/credentials`
    * **Signature:** `credentials.list(options: RequestOptions = .init()) async throws -> [Credential]`

    ```swift list_credentials.swift theme={null}
    let credentials = try await client.credentials.list()
    for credential in credentials {
        print(credential.id, credential.name, credential.provider)
    }
    ```
  </Accordion>

  <Accordion title="`create`">
    Create a new credential.

    * **HTTP endpoint:** `POST /api/credentials`
    * **Signature:** `credentials.create(_ input: CredentialInput, options: RequestOptions = .init()) async throws -> Credential`

    ```swift create_credential.swift theme={null}
    let input = CredentialInput(
        name: "Production Baserow",
        provider: "baserow",
        config: ["apiUrl": "https://api.baserow.io", "token": "my-token"]
    )
    let credential = try await client.credentials.create(input)
    print(credential.id)
    ```
  </Accordion>

  <Accordion title="`update`">
    Update an existing credential in place.

    * **HTTP endpoint:** `PUT /api/credentials/{credentialId}`
    * **Signature:** `credentials.update(_ id: String, input: CredentialInput, options: RequestOptions = .init()) async throws -> Credential`

    ```swift update_credential.swift theme={null}
    let input = CredentialInput(
        name: "Production Baserow",
        provider: "baserow",
        config: ["apiUrl": "https://api.baserow.io", "token": "new-token"]
    )
    let credential = try await client.credentials.update("cred_01", input: input)
    print(credential.id)
    ```
  </Accordion>

  <Accordion title="`delete`">
    Delete a credential.

    * **HTTP endpoint:** `DELETE /api/credentials/{credentialId}`
    * **Signature:** `credentials.delete(_ id: String, options: RequestOptions = .init()) async throws -> JSONObject`

    ```swift delete_credential.swift theme={null}
    let result = try await client.credentials.delete("cred_01")
    ```
  </Accordion>

  <Accordion title="`baserowDatabases`">
    List Baserow databases through a stored credential. The server proxies the request using the credential's token.

    * **HTTP endpoint:** `GET /api/credentials/{credentialId}/proxy/baserow/databases`
    * **Signature:** `credentials.baserowDatabases(_ id: String, options: RequestOptions = .init()) async throws -> JSONObject`

    ```swift baserow_databases.swift theme={null}
    let result = try await client.credentials.baserowDatabases("cred_01")
    ```
  </Accordion>

  <Accordion title="`baserowTables`">
    List tables inside a Baserow database through a stored credential.

    * **HTTP endpoint:** `GET /api/credentials/{credentialId}/proxy/baserow/databases/{databaseId}/tables`
    * **Signature:** `credentials.baserowTables(_ id: String, databaseID: String, options: RequestOptions = .init()) async throws -> JSONObject`

    ```swift baserow_tables.swift theme={null}
    let result = try await client.credentials.baserowTables("cred_01", databaseID: "db_123")
    ```
  </Accordion>
</AccordionGroup>

## Models

### `CredentialInput`

```swift theme={null}
public struct CredentialInput: Codable, Sendable {
    public var name: String
    public var provider: String
    public var config: [String: String]

    public init(name: String, provider: String = "baserow", config: [String: String])
}
```

### `Credential`

```swift theme={null}
public struct Credential: Codable, Sendable {
    public var id: String
    public var name: String
    public var provider: String
    public var config: [String: String]
}
```

## Related resources

<CardGroup cols={2}>
  <Card title="Request options" icon="sliders" href="/docs/sdk/swift/request-options">
    Pass custom headers and per-request timeouts.
  </Card>

  <Card title="Errors" icon="alert-triangle" href="/docs/sdk/swift/errors">
    Handle FigraniumError responses.
  </Card>

  <Card title="Tasks resource" icon="list-check" href="/docs/sdk/swift/resources/tasks">
    Save tasks that reference credentials by ID.
  </Card>

  <Card title="Executions" icon="bolt" href="/docs/sdk/swift/resources/executions">
    Start runs that use credentials for external integrations.
  </Card>
</CardGroup>
