# Imports

The Imports API provides allows you to import content into GitBook.

## POST /org/{organizationId}/imports

> Import content into a space from a website

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"imports","description":"The Imports API provides allows you to import content into GitBook.\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"}},"parameters":{"organizationId":{"name":"organizationId","in":"path","required":true,"description":"The unique id of the organization","schema":{"$ref":"#/components/schemas/EntityId"}}},"schemas":{"EntityId":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"A unique entity identifier"},"ContentImportSource":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["website"]},"url":{"$ref":"#/components/schemas/URL"}},"required":["type","url"]},{"type":"object","properties":{"type":{"type":"string","enum":["file"]},"files":{"description":"Files to import","type":"array","maxItems":50,"items":{"description":"Key of file","type":"string"}}},"required":["type","files"]}]},"URL":{"type":"string","format":"uri","maxLength":2048},"ContentImportTarget":{"type":"object","properties":{"space":{"type":"string","description":"ID of the space to import in"},"changeRequest":{"type":"string","description":"ID of the change request to import in"},"page":{"type":"string","description":"ID of the page to import in"}},"required":["space"]},"ContentImportRun":{"type":"object","properties":{"id":{"description":"Unique ID of the import","type":"string"},"startedAt":{"description":"Date when the import has started","$ref":"#/components/schemas/Timestamp"},"completedAt":{"description":"Filled when the imported is in status \"completed\"","$ref":"#/components/schemas/Timestamp"},"status":{"description":"Status of the import","type":"string","enum":["pending","in-progress","completed","failed","cancelled"]},"pages":{"description":"Pages included in the import","type":"array","items":{"type":"object","properties":{"id":{"description":"ID of page","type":"string"},"sourceURL":{"description":"Source URL where the page has been imported from","type":"string"},"type":{"description":"Type of page","type":"string","enum":["page","folder"]},"status":{"description":"Status of the page","type":"string","enum":["complete","pending"]}},"required":["id","type","status"]}}},"required":["id","status"]},"Timestamp":{"type":"string","format":"date-time"}},"responses":{"BadRequestError":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","enum":[400]},"message":{"type":"string"}},"required":["code","message"]}}}}}},"NotFoundError":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","enum":[404]},"message":{"type":"string"}},"required":["code","message"]}}}}}}}},"paths":{"/org/{organizationId}/imports":{"post":{"operationId":"startImportRun","summary":"Import content into a space from a website","tags":["imports"],"parameters":[{"$ref":"#/components/parameters/organizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"source":{"$ref":"#/components/schemas/ContentImportSource"},"target":{"$ref":"#/components/schemas/ContentImportTarget"},"enhance":{"description":"Enhance the imported content with AI","default":true,"type":"boolean"}},"required":["source","target"]}}}},"responses":{"201":{"description":"Import run created successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentImportRun"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"404":{"$ref":"#/components/responses/NotFoundError"}}}}}}
```

## POST /org/{organizationId}/imports/{importRunId}/cancel

> Cancel an import run

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"imports","description":"The Imports API provides allows you to import content into GitBook.\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"}},"parameters":{"organizationId":{"name":"organizationId","in":"path","required":true,"description":"The unique id of the organization","schema":{"$ref":"#/components/schemas/EntityId"}},"importRunId":{"name":"importRunId","in":"path","required":true,"description":"The unique id of the import run","schema":{"type":"string"}}},"schemas":{"EntityId":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"A unique entity identifier"},"ContentImportRun":{"type":"object","properties":{"id":{"description":"Unique ID of the import","type":"string"},"startedAt":{"description":"Date when the import has started","$ref":"#/components/schemas/Timestamp"},"completedAt":{"description":"Filled when the imported is in status \"completed\"","$ref":"#/components/schemas/Timestamp"},"status":{"description":"Status of the import","type":"string","enum":["pending","in-progress","completed","failed","cancelled"]},"pages":{"description":"Pages included in the import","type":"array","items":{"type":"object","properties":{"id":{"description":"ID of page","type":"string"},"sourceURL":{"description":"Source URL where the page has been imported from","type":"string"},"type":{"description":"Type of page","type":"string","enum":["page","folder"]},"status":{"description":"Status of the page","type":"string","enum":["complete","pending"]}},"required":["id","type","status"]}}},"required":["id","status"]},"Timestamp":{"type":"string","format":"date-time"}},"responses":{"BadRequestError":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","enum":[400]},"message":{"type":"string"}},"required":["code","message"]}}}}}},"NotFoundError":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","enum":[404]},"message":{"type":"string"}},"required":["code","message"]}}}}}}}},"paths":{"/org/{organizationId}/imports/{importRunId}/cancel":{"post":{"operationId":"cancelImportRun","summary":"Cancel an import run","tags":["imports"],"parameters":[{"$ref":"#/components/parameters/organizationId"},{"$ref":"#/components/parameters/importRunId"}],"responses":{"201":{"description":"Import run canceled successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentImportRun"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"404":{"$ref":"#/components/responses/NotFoundError"}}}}}}
```
