---
title: "createRepoAttachmentBlob"
---

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

# createRepoAttachmentBlob

Path: Forge API › attachmentBlobs

`POST /repos/{repo_id}/attachment-blobs`

Create an attachment blob for a file of the given name, media type, and size, and answer the signed URLs to send its bytes to storage: one PUT up to 16 MiB, and parts past that. An attachment field takes its id as {"id":…}, and a binary extension file as its "attachment_blob_id".

## Path parameters

- `repo_id` (`createRepoAttachmentBlob.path.repo_id`; string, required)
  - pattern: `^repo_[0-7][0-9a-hjkmnp-tv-z]{25}$`

## Request body

_Required._

- `filename` (`createRepoAttachmentBlob.filename`; string, required)
  - minLength: `1`
- `content_type` (`createRepoAttachmentBlob.content_type`; string, required)
  - minLength: `1`
- `size` (`createRepoAttachmentBlob.size`; integer, required)
  - maximum: `5492189429760` · minimum: `0`

## Example request

```json
{
  "filename": "string",
  "content_type": "string",
  "size": 0
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url '<base-url>/repos/<repo_id>/attachment-blobs' \
  --header 'Content-Type: application/json' \
  --data '
{
  "filename": "string",
  "content_type": "string",
  "size": 0
}
'
```

### TypeScript

```typescript
const url = '<base-url>/repos/<repo_id>/attachment-blobs';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({filename: 'string', content_type: 'string', size: 0})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/repos/<repo_id>/attachment-blobs"

payload = {
    "filename": "string",
    "content_type": "string",
    "size": 0
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

AttachmentBlobUpload

#### Example

```json
{
  "attachment_blob": {
    "id": "string",
    "filename": "string",
    "content_type": "string",
    "size": 0,
    "created_by_id": "string",
    "created_at": "string",
    "uploaded_at": "string",
    "promoted_at": "string"
  },
  "parts": [
    {
      "url": "string",
      "offset": -9007199254740991,
      "length": -9007199254740991,
      "headers": {
        "property1": "string",
        "property2": "string"
      }
    }
  ],
  "expires_at": "string"
}
```

- `attachment_blob` (`createRepoAttachmentBlob.response.201.attachment_blob`; object, required)
  - `id` (`createRepoAttachmentBlob.response.201.attachment_blob.id`; string, required)
    - pattern: `^[a-z](?:[a-z_]{0,61}[a-z])?_[0-7][0-9a-hjkmnp-tv-z]{25}$`
  - `filename` (`createRepoAttachmentBlob.response.201.attachment_blob.filename`; string, required)
    - minLength: `1`
  - `content_type` (`createRepoAttachmentBlob.response.201.attachment_blob.content_type`; string, required)
    - minLength: `1`
  - `size` (`createRepoAttachmentBlob.response.201.attachment_blob.size`; integer, required)
    - maximum: `9007199254740991` · minimum: `0`
  - `created_by_id` (`createRepoAttachmentBlob.response.201.attachment_blob.created_by_id`; string, required)
    - pattern: `^(?:user|extension)_[0-7][0-9a-hjkmnp-tv-z]{25}$`
  - `created_at` (`createRepoAttachmentBlob.response.201.attachment_blob.created_at`; string, required)
  - `uploaded_at` (`createRepoAttachmentBlob.response.201.attachment_blob.uploaded_at`; any of, required)
    - any of the following: `string`, `null`
  - `promoted_at` (`createRepoAttachmentBlob.response.201.attachment_blob.promoted_at`; any of, required)
    - any of the following: `string`, `null`
- `parts` (`createRepoAttachmentBlob.response.201.parts`; array of object, required)
  - `url` (`createRepoAttachmentBlob.response.201.parts.url`; string, required)
    - minLength: `1`
  - `offset` (`createRepoAttachmentBlob.response.201.parts.offset`; integer, required)
    - maximum: `9007199254740991` · minimum: `-9007199254740991`
  - `length` (`createRepoAttachmentBlob.response.201.parts.length`; integer, required)
    - maximum: `9007199254740991` · minimum: `-9007199254740991`
  - `headers` (`createRepoAttachmentBlob.response.201.parts.headers`; map of string, required)
- `expires_at` (`createRepoAttachmentBlob.response.201.expires_at`; string, required)
  - minLength: `1`

### 400

InvalidRequest | RequestBodyTooDeep

#### Example

```json
{
  "_tag": "InvalidRequest",
  "part": "path",
  "issues": [
    {
      "path": [
        "string"
      ],
      "message": "string"
    }
  ]
}
```

Any of the following:

- `InvalidRequestEncoded`
  - `_tag` (`InvalidRequestEncoded._tag`; string, required)
    - one of `"InvalidRequest"`
  - `part` (`InvalidRequestEncoded.part`; string, required)
    - one of `"path"`, `"query"`, `"headers"`, `"body"`
  - `issues` (`InvalidRequestEncoded.issues`; array of object, required)
    - `path` (`InvalidRequestEncoded.issues.path`; array\<any of\>, required)
      - any of the following: `string`, `integer`
    - `message` (`InvalidRequestEncoded.issues.message`; string, required)
- `RequestBodyTooDeepEncoded`
  - `_tag` (`RequestBodyTooDeepEncoded._tag`; string, required)
    - one of `"RequestBodyTooDeep"`
  - `max_depth` (`RequestBodyTooDeepEncoded.max_depth`; integer, required)
    - maximum: `9007199254740991` · minimum: `-9007199254740991`

### 401

InvalidCredentials

#### Example

```json
{
  "_tag": "InvalidCredentials"
}
```

- `_tag` (`createRepoAttachmentBlob.response.401._tag`; string, required)
  - one of `"InvalidCredentials"`

### 402

StorageLimitReached

#### Example

```json
{
  "_tag": "StorageLimitReached",
  "plan": "free",
  "included_bytes": -9007199254740991,
  "message": "string"
}
```

- `_tag` (`createRepoAttachmentBlob.response.402._tag`; string, required)
  - one of `"StorageLimitReached"`
- `plan` (`createRepoAttachmentBlob.response.402.plan`; string, required)
  - one of `"free"`, `"pro"`, `"team"`
- `included_bytes` (`createRepoAttachmentBlob.response.402.included_bytes`; integer, required)
  - maximum: `9007199254740991` · minimum: `-9007199254740991`
- `message` (`createRepoAttachmentBlob.response.402.message`; string, required)

### 403

Forbidden | ForbiddenOrigin | RequiresPersonalSession | RunBranchRequired

#### Example

```json
{
  "_tag": "Forbidden",
  "message": "string"
}
```

Any of the following:

- `ForbiddenEncoded`
  - `_tag` (`ForbiddenEncoded._tag`; string, required)
    - one of `"Forbidden"`
  - `message` (`ForbiddenEncoded.message`; string, required)
- `ForbiddenOriginEncoded`
  - `_tag` (`ForbiddenOriginEncoded._tag`; string, required)
    - one of `"ForbiddenOrigin"`
- `RequiresPersonalSessionEncoded`
  - `_tag` (`RequiresPersonalSessionEncoded._tag`; string, required)
    - one of `"RequiresPersonalSession"`
- `RunBranchRequiredEncoded`
  - `_tag` (`RunBranchRequiredEncoded._tag`; string, required)
    - one of `"RunBranchRequired"`
  - `branch` (`RunBranchRequiredEncoded.branch`; string, required)
    - minLength: `1`
  - `message` (`RunBranchRequiredEncoded.message`; string, required)

### 404

RepoNotFound

#### Example

```json
{
  "_tag": "RepoNotFound"
}
```

- `_tag` (`createRepoAttachmentBlob.response.404._tag`; string, required)
  - one of `"RepoNotFound"`

### 409

RepoArchived

#### Example

```json
{
  "_tag": "RepoArchived"
}
```

- `_tag` (`createRepoAttachmentBlob.response.409._tag`; string, required)
  - one of `"RepoArchived"`

### 413

WriteTooLarge | RequestBodyTooLarge

#### Example

```json
{
  "_tag": "WriteTooLarge",
  "message": "string"
}
```

Any of the following:

- `WriteTooLargeEncoded`
  - `_tag` (`WriteTooLargeEncoded._tag`; string, required)
    - one of `"WriteTooLarge"`
  - `message` (`WriteTooLargeEncoded.message`; string, required)
- `RequestBodyTooLargeEncoded`
  - `_tag` (`RequestBodyTooLargeEncoded._tag`; string, required)
    - one of `"RequestBodyTooLarge"`
  - `max_bytes` (`RequestBodyTooLargeEncoded.max_bytes`; integer, required)
    - maximum: `9007199254740991` · minimum: `-9007199254740991`

### 429

RateLimited

#### Example

```json
{
  "_tag": "RateLimited"
}
```

- `_tag` (`createRepoAttachmentBlob.response.429._tag`; string, required)
  - one of `"RateLimited"`

### 500

AttachmentUrlFailed | RepoFailure

#### Example

```json
{
  "_tag": "AttachmentUrlFailed"
}
```

Any of the following:

- `AttachmentUrlFailedEncoded`
  - `_tag` (`AttachmentUrlFailedEncoded._tag`; string, required)
    - one of `"AttachmentUrlFailed"`
- `RepoFailureEncoded`
  - `_tag` (`RepoFailureEncoded._tag`; string, required)
    - one of `"RepoFailure"`
  - `reason` (`RepoFailureEncoded.reason`; string, required)

### 503

AttachmentStorageUnavailable | RepoBusy | SessionUnavailable | RateLimitUnavailable

#### Example

```json
{
  "_tag": "AttachmentStorageUnavailable"
}
```

Any of the following:

- `AttachmentStorageUnavailableEncoded`
  - `_tag` (`AttachmentStorageUnavailableEncoded._tag`; string, required)
    - one of `"AttachmentStorageUnavailable"`
- `RepoBusyEncoded`
  - `_tag` (`RepoBusyEncoded._tag`; string, required)
    - one of `"RepoBusy"`
  - `message` (`RepoBusyEncoded.message`; string, required)
- `SessionUnavailableEncoded`
  - `_tag` (`SessionUnavailableEncoded._tag`; string, required)
    - one of `"SessionUnavailable"`
- `RateLimitUnavailableEncoded`
  - `_tag` (`RateLimitUnavailableEncoded._tag`; string, required)
    - one of `"RateLimitUnavailable"`


Source: https://buildrforge.com/docs/api/create-repo-attachment-blob/index.md
