---
title: "createOrgOpenApiImportExtensionFiles"
---

> 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.

# createOrgOpenApiImportExtensionFiles

Path: Forge API › openapiImports

`POST /orgs/{org_id}/openapi-imports/{import_id}/extension-files`

Write an extension's files from a ready import, for createRepoExtensionFile to add as they are: openapi.ts, which holds the tools and the part of the document they read, and index.ts, which declares a provider from the document's security schemes and turns every tool of openapi.ts into the extension's. Without tags, paths, or operations it takes every operation, up to 500; with them, the operations that carry any of the tags, sit under any of the path prefixes, such as /v1/customers, or that operations names. Forge names each tool from its first tag and its operation id, as projects.listProjects. An operation that can't become a tool is left out and listed in skipped with why.

## Path parameters

- `org_id` (`createOrgOpenApiImportExtensionFiles.path.org_id`; string, required)
  - pattern: `^org_[0-7][0-9a-hjkmnp-tv-z]{25}$`
- `import_id` (`createOrgOpenApiImportExtensionFiles.path.import_id`; string, required)
  - minLength: `1`

## Request body

_Required._

- `tags` (`createOrgOpenApiImportExtensionFiles.tags`; any of, optional)
  - any of the following: `array<string>`, `null`
- `paths` (`createOrgOpenApiImportExtensionFiles.paths`; any of, optional)
  - any of the following: `array<string>`, `null`
- `operations` (`createOrgOpenApiImportExtensionFiles.operations`; any of, optional)
  - any of the following: `array<string>`, `null`

## Example request

```json
{
  "tags": [
    "string"
  ],
  "paths": [
    "string"
  ],
  "operations": [
    "string"
  ]
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url '<base-url>/orgs/<org_id>/openapi-imports/<import_id>/extension-files' \
  --header 'Content-Type: application/json' \
  --data '
{
  "tags": [
    "string"
  ],
  "paths": [
    "string"
  ],
  "operations": [
    "string"
  ]
}
'
```

### TypeScript

```typescript
const url = '<base-url>/orgs/<org_id>/openapi-imports/<import_id>/extension-files';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({tags: ['string'], paths: ['string'], operations: ['string']})
};

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

### Python

```python
import requests

url = "<base-url>/orgs/<org_id>/openapi-imports/<import_id>/extension-files"

payload = {
    "tags": ["string"],
    "paths": ["string"],
    "operations": ["string"]
}
headers = {"Content-Type": "application/json"}

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

print(response.text)
```

## Responses

### 200

OpenApiExtensionFiles

#### Example

```json
{
  "files": [
    {
      "path": "string",
      "content": "string"
    }
  ],
  "tools": [
    {
      "name": "string",
      "operation": "string"
    }
  ],
  "skipped": [
    {
      "operation": "string",
      "reason": "string"
    }
  ]
}
```

- `files` (`createOrgOpenApiImportExtensionFiles.response.200.files`; array of object, required)
  - `path` (`createOrgOpenApiImportExtensionFiles.response.200.files.path`; string, required)
    - minLength: `1`
  - `content` (`createOrgOpenApiImportExtensionFiles.response.200.files.content`; string, required)
    - minLength: `1`
- `tools` (`createOrgOpenApiImportExtensionFiles.response.200.tools`; array of object, required)
  - `name` (`createOrgOpenApiImportExtensionFiles.response.200.tools.name`; string, required)
    - minLength: `1`
  - `operation` (`createOrgOpenApiImportExtensionFiles.response.200.tools.operation`; string, required)
    - minLength: `1`
- `skipped` (`createOrgOpenApiImportExtensionFiles.response.200.skipped`; array of object, required)
  - `operation` (`createOrgOpenApiImportExtensionFiles.response.200.skipped.operation`; string, required)
  - `reason` (`createOrgOpenApiImportExtensionFiles.response.200.skipped.reason`; 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` (`createOrgOpenApiImportExtensionFiles.response.401._tag`; string, required)
  - one of `"InvalidCredentials"`

### 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

OrgNotFound | OpenApiImportNotFound

#### Example

```json
{
  "_tag": "OrgNotFound"
}
```

Any of the following:

- `OrgNotFoundEncoded`
  - `_tag` (`OrgNotFoundEncoded._tag`; string, required)
    - one of `"OrgNotFound"`
- `OpenApiImportNotFoundEncoded`
  - `_tag` (`OpenApiImportNotFoundEncoded._tag`; string, required)
    - one of `"OpenApiImportNotFound"`

### 409

OpenApiImportNotReady

#### Example

```json
{
  "_tag": "OpenApiImportNotReady",
  "state": "importing"
}
```

- `_tag` (`createOrgOpenApiImportExtensionFiles.response.409._tag`; string, required)
  - one of `"OpenApiImportNotReady"`
- `state` (`createOrgOpenApiImportExtensionFiles.response.409.state`; string, required)
  - one of `"importing"`, `"ready"`, `"failed"`

### 413

RequestBodyTooLarge

#### Example

```json
{
  "_tag": "RequestBodyTooLarge",
  "max_bytes": -9007199254740991
}
```

- `_tag` (`createOrgOpenApiImportExtensionFiles.response.413._tag`; string, required)
  - one of `"RequestBodyTooLarge"`
- `max_bytes` (`createOrgOpenApiImportExtensionFiles.response.413.max_bytes`; integer, required)
  - maximum: `9007199254740991` · minimum: `-9007199254740991`

### 422

OpenApiSelectionRefused

#### Example

```json
{
  "_tag": "OpenApiSelectionRefused",
  "reason": "string"
}
```

- `_tag` (`createOrgOpenApiImportExtensionFiles.response.422._tag`; string, required)
  - one of `"OpenApiSelectionRefused"`
- `reason` (`createOrgOpenApiImportExtensionFiles.response.422.reason`; string, required)
  - minLength: `1`

### 429

RateLimited

#### Example

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

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

### 500

OrgFailure

#### Example

```json
{
  "_tag": "OrgFailure",
  "reason": "string"
}
```

- `_tag` (`createOrgOpenApiImportExtensionFiles.response.500._tag`; string, required)
  - one of `"OrgFailure"`
- `reason` (`createOrgOpenApiImportExtensionFiles.response.500.reason`; string, required)

### 503

SessionUnavailable | RateLimitUnavailable

#### Example

```json
{
  "_tag": "SessionUnavailable"
}
```

Any of the following:

- `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-org-open-api-import-extension-files/index.md
