## Add Directory File

`FileAddResponse Beta.Directories.Files.Add(FileAddParamsparameters, CancellationTokencancellationToken = default)`

**post** `/api/v1/beta/directories/{directory_id}/files`

Create a new file within the specified directory; the directory must exist in the project and `file_id` must reference an existing file.

### Parameters

- `FileAddParams parameters`

  - `required string directoryID`

    Path param

  - `required string fileID`

    Body param: File ID for the storage location (required).

  - `string? organizationID`

    Query param

  - `string? projectID`

    Query param

  - `string? displayName`

    Body param: Display name for the file. If not provided, will use the file's name.

  - `IReadOnlyDictionary<string, Metadata>? metadata`

    Body param: User-defined metadata key-value pairs to associate with the file.

    - `string`

    - `Long`

    - `Double`

    - `Boolean`

    - `JsonElement`

    - `IReadOnlyList<string>`

  - `string? uniqueID`

    Body param: Unique identifier for the file in the directory. If not provided, will use the file's external_file_id or name.

### Returns

- `class FileAddResponse:`

  API response schema for a directory file.

  - `required string ID`

    Unique identifier for the directory file.

  - `required string DirectoryID`

    Directory the file belongs to.

  - `required string DisplayName`

    Display name for the file.

  - `required string ProjectID`

    Project the directory file belongs to.

  - `required string UniqueID`

    Unique identifier for the file in the directory

  - `DateTimeOffset? CreatedAt`

    Creation datetime

  - `DateTimeOffset? DeletedAt`

    Soft delete marker when the file is removed upstream or by user action.

  - `PresignedUrl? DownloadUrl`

    Schema for a presigned URL.

    - `required DateTimeOffset ExpiresAt`

      The time at which the presigned URL expires

    - `required string Url`

      A presigned URL for IO operations against a private file

    - `IReadOnlyDictionary<string, string>? FormFields`

      Form fields for a presigned POST request

  - `string? FileID`

    File ID for the storage location.

  - `IReadOnlyDictionary<string, Metadata> Metadata`

    Merged metadata from all sources. Higher-priority sources override lower.

    - `string`

    - `Long`

    - `Double`

    - `Boolean`

    - `JsonElement`

    - `IReadOnlyList<string>`

  - `DateTimeOffset? UpdatedAt`

    Update datetime

### Example

```csharp
FileAddParams parameters = new()
{
    DirectoryID = "directory_id",
    FileID = "file_id",
};

var response = await client.Beta.Directories.Files.Add(parameters);

Console.WriteLine(response);
```

#### Response

```json
{
  "id": "id",
  "directory_id": "directory_id",
  "display_name": "x",
  "project_id": "project_id",
  "unique_id": "x",
  "created_at": "2019-12-27T18:11:19.117Z",
  "deleted_at": "2019-12-27T18:11:19.117Z",
  "download_url": {
    "expires_at": "2019-12-27T18:11:19.117Z",
    "url": "https://example.com",
    "form_fields": {
      "foo": "string"
    }
  },
  "file_id": "file_id",
  "metadata": {
    "foo": "string"
  },
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```
