> For the complete documentation index, see [llms.txt](https://help.paintscout.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.paintscout.com/developers/files.md).

# Files

## Create Files

> Adds files by URL to a deal, contact or company. The files are saved at once with your URL as \`src\` and \`importStatus\` \`pending\`, and copied to PaintScout's storage in the background. Read the record again later to see each file's final \`src\` and \`importStatus\`. The request fails with a \`400\` if it has more than 10 files, or if a URL is not \`https\` or resolves to a private address.

```json
{"openapi":"3.0.0","info":{"title":"Core API","version":"v2"},"servers":[{"url":"https://openapi.paintscout.com/v2"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"FileCreate":{"type":"object","additionalProperties":false,"required":["files"],"properties":{"files":{"type":"array","description":"Files to add, at most 10 per request.","minItems":1,"maxItems":10,"items":{"type":"object","additionalProperties":false,"required":["url"],"properties":{"url":{"type":"string","description":"An `https` URL of the file. PaintScout copies it in the background. Allowed types, detected from the file's contents: JPEG, PNG, GIF, WebP (20 MB), PDF (25 MB), MP4 and MOV (100 MB)."},"title":{"type":"string","description":"Optional title for the file"},"visibility":{"type":"string","description":"The visibility of the file","enum":["visible","customer","crew","hidden"]}}}}}},"File":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","description":"The unique ID of the File"},"title":{"type":"string","nullable":true,"description":"The title of the File"},"src":{"type":"string","nullable":true,"description":"The URL of the File. For a file added by URL, this is the URL you gave until the background copy finishes (`importStatus` `pending`) or fails (`failed`), and the PaintScout copy once it is `stored`."},"type":{"type":"string","nullable":true,"description":"The MIME type of the File (e.g. image/jpeg, application/pdf)"},"format":{"type":"string","nullable":true,"description":"The file format/extension (e.g. jpg, pdf, png)"},"visibility":{"type":"string","nullable":true,"description":"The visibility of the File","enum":["visible","customer","crew","hidden"]},"importStatus":{"type":"string","nullable":true,"description":"Where the background copy of a file added by URL stands. `pending`: not finished, `src` is your URL. `stored`: `src` is the PaintScout copy. `failed`: the file was refused or could not be fetched, `src` stays your URL and `importError` says why.","enum":["pending","stored","failed"]},"importError":{"type":"string","nullable":true,"description":"Why the background copy failed, as a fixed sentence (for example, the file type is not supported, the file is too large, or the copy could not be started). Set only when `importStatus` is `failed`."},"timestamp":{"$ref":"#/components/schemas/Timestamp"}}},"Timestamp":{"type":"object","additionalProperties":false,"properties":{"created":{"type":"number","description":"The timestamp when this entity was created"},"updated":{"type":"number","description":"The timestamp when this entity was last updated"}}},"Error":{"type":"object","additionalProperties":false,"properties":{"errors":{"type":"array","items":{"type":"string"},"description":"Array of error messages"}}}}},"paths":{"/files":{"post":{"summary":"Create Files","description":"Adds files by URL to a deal, contact or company. The files are saved at once with your URL as `src` and `importStatus` `pending`, and copied to PaintScout's storage in the background. Read the record again later to see each file's final `src` and `importStatus`. The request fails with a `400` if it has more than 10 files, or if a URL is not `https` or resolves to a private address.","operationId":"createFiles","tags":["Files"],"parameters":[{"name":"docId","in":"query","required":true,"schema":{"type":"string"},"description":"The document ID to attach files to"},{"name":"docType","in":"query","required":true,"schema":{"type":"string","enum":["deal","contact","company"]},"description":"The document type (deal, contact, or company)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileCreate"}}}},"responses":{"200":{"description":"Array of created files","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/File"}}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Not Authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.paintscout.com/developers/files.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
