# Checkpoints

# Permissions

## List checkpoint permissions

`fine_tuning.checkpoints.permissions.retrieve(fine_tuned_model_checkpoint, **kwargs) -> PermissionRetrieveResponse`

**get** `/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions`

**NOTE:** This endpoint requires an [admin API key](../admin-api-keys).

Organization owners can use this endpoint to view all permissions for a fine-tuned model checkpoint.

### Parameters

- `fine_tuned_model_checkpoint: String`

- `after: String`

  Identifier for the last permission ID from the previous pagination request.

- `limit: Integer`

  Number of permissions to retrieve.

- `order: :ascending | :descending`

  The order in which to retrieve permissions.

  - `:ascending`

  - `:descending`

- `project_id: String`

  The ID of the project to get permissions for.

### Returns

- `class PermissionRetrieveResponse`

  - `data: Array[Data{ id, created_at, object, project_id}]`

    - `id: String`

      The permission identifier, which can be referenced in the API endpoints.

    - `created_at: Integer`

      The Unix timestamp (in seconds) for when the permission was created.

    - `object: :"checkpoint.permission"`

      The object type, which is always "checkpoint.permission".

      - `:"checkpoint.permission"`

    - `project_id: String`

      The project identifier that the permission is for.

  - `has_more: bool`

  - `object: :list`

    - `:list`

  - `first_id: String`

  - `last_id: String`

### Example

```ruby
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

permission = openai.fine_tuning.checkpoints.permissions.retrieve("ft-AF1WoRqd3aJAHsqc9NY7iL8F")

puts(permission)
```

#### Response

```json
{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "object": "checkpoint.permission",
      "project_id": "project_id"
    }
  ],
  "has_more": true,
  "object": "list",
  "first_id": "first_id",
  "last_id": "last_id"
}
```

## List checkpoint permissions

`fine_tuning.checkpoints.permissions.list(fine_tuned_model_checkpoint, **kwargs) -> ConversationCursorPage<PermissionListResponse>`

**get** `/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions`

**NOTE:** This endpoint requires an [admin API key](../admin-api-keys).

Organization owners can use this endpoint to view all permissions for a fine-tuned model checkpoint.

### Parameters

- `fine_tuned_model_checkpoint: String`

- `after: String`

  Identifier for the last permission ID from the previous pagination request.

- `limit: Integer`

  Number of permissions to retrieve.

- `order: :ascending | :descending`

  The order in which to retrieve permissions.

  - `:ascending`

  - `:descending`

- `project_id: String`

  The ID of the project to get permissions for.

### Returns

- `class PermissionListResponse`

  The `checkpoint.permission` object represents a permission for a fine-tuned model checkpoint.

  - `id: String`

    The permission identifier, which can be referenced in the API endpoints.

  - `created_at: Integer`

    The Unix timestamp (in seconds) for when the permission was created.

  - `object: :"checkpoint.permission"`

    The object type, which is always "checkpoint.permission".

    - `:"checkpoint.permission"`

  - `project_id: String`

    The project identifier that the permission is for.

### Example

```ruby
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

page = openai.fine_tuning.checkpoints.permissions.list("ft-AF1WoRqd3aJAHsqc9NY7iL8F")

puts(page)
```

#### Response

```json
{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "object": "checkpoint.permission",
      "project_id": "project_id"
    }
  ],
  "has_more": true,
  "object": "list",
  "first_id": "first_id",
  "last_id": "last_id"
}
```

## Create checkpoint permissions

`fine_tuning.checkpoints.permissions.create(fine_tuned_model_checkpoint, **kwargs) -> Page<PermissionCreateResponse>`

**post** `/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions`

**NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).

This enables organization owners to share fine-tuned models with other projects in their organization.

### Parameters

- `fine_tuned_model_checkpoint: String`

- `project_ids: Array[String]`

  The project identifiers to grant access to.

### Returns

- `class PermissionCreateResponse`

  The `checkpoint.permission` object represents a permission for a fine-tuned model checkpoint.

  - `id: String`

    The permission identifier, which can be referenced in the API endpoints.

  - `created_at: Integer`

    The Unix timestamp (in seconds) for when the permission was created.

  - `object: :"checkpoint.permission"`

    The object type, which is always "checkpoint.permission".

    - `:"checkpoint.permission"`

  - `project_id: String`

    The project identifier that the permission is for.

### Example

```ruby
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

page = openai.fine_tuning.checkpoints.permissions.create(
  "ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd",
  project_ids: ["string"]
)

puts(page)
```

#### Response

```json
{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "object": "checkpoint.permission",
      "project_id": "project_id"
    }
  ],
  "has_more": true,
  "object": "list",
  "first_id": "first_id",
  "last_id": "last_id"
}
```

## Delete checkpoint permission

`fine_tuning.checkpoints.permissions.delete(permission_id, **kwargs) -> PermissionDeleteResponse`

**delete** `/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id}`

**NOTE:** This endpoint requires an [admin API key](../admin-api-keys).

Organization owners can use this endpoint to delete a permission for a fine-tuned model checkpoint.

### Parameters

- `fine_tuned_model_checkpoint: String`

- `permission_id: String`

### Returns

- `class PermissionDeleteResponse`

  - `id: String`

    The ID of the fine-tuned model checkpoint permission that was deleted.

  - `deleted: bool`

    Whether the fine-tuned model checkpoint permission was successfully deleted.

  - `object: :"checkpoint.permission"`

    The object type, which is always "checkpoint.permission".

    - `:"checkpoint.permission"`

### Example

```ruby
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

permission = openai.fine_tuning.checkpoints.permissions.delete(
  "cp_zc4Q7MP6XxulcVzj4MZdwsAB",
  fine_tuned_model_checkpoint: "ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd"
)

puts(permission)
```

#### Response

```json
{
  "id": "id",
  "deleted": true,
  "object": "checkpoint.permission"
}
```

## Domain Types

### Permission Retrieve Response

- `class PermissionRetrieveResponse`

  - `data: Array[Data{ id, created_at, object, project_id}]`

    - `id: String`

      The permission identifier, which can be referenced in the API endpoints.

    - `created_at: Integer`

      The Unix timestamp (in seconds) for when the permission was created.

    - `object: :"checkpoint.permission"`

      The object type, which is always "checkpoint.permission".

      - `:"checkpoint.permission"`

    - `project_id: String`

      The project identifier that the permission is for.

  - `has_more: bool`

  - `object: :list`

    - `:list`

  - `first_id: String`

  - `last_id: String`

### Permission List Response

- `class PermissionListResponse`

  The `checkpoint.permission` object represents a permission for a fine-tuned model checkpoint.

  - `id: String`

    The permission identifier, which can be referenced in the API endpoints.

  - `created_at: Integer`

    The Unix timestamp (in seconds) for when the permission was created.

  - `object: :"checkpoint.permission"`

    The object type, which is always "checkpoint.permission".

    - `:"checkpoint.permission"`

  - `project_id: String`

    The project identifier that the permission is for.

### Permission Create Response

- `class PermissionCreateResponse`

  The `checkpoint.permission` object represents a permission for a fine-tuned model checkpoint.

  - `id: String`

    The permission identifier, which can be referenced in the API endpoints.

  - `created_at: Integer`

    The Unix timestamp (in seconds) for when the permission was created.

  - `object: :"checkpoint.permission"`

    The object type, which is always "checkpoint.permission".

    - `:"checkpoint.permission"`

  - `project_id: String`

    The project identifier that the permission is for.

### Permission Delete Response

- `class PermissionDeleteResponse`

  - `id: String`

    The ID of the fine-tuned model checkpoint permission that was deleted.

  - `deleted: bool`

    Whether the fine-tuned model checkpoint permission was successfully deleted.

  - `object: :"checkpoint.permission"`

    The object type, which is always "checkpoint.permission".

    - `:"checkpoint.permission"`
