Attach a pending file to a record

Files of file fields. Upload in three steps: start an upload, send the bytes to the returned URL, then write the file id into the file field with /v1/records/mutate or attach it with /v1/files/{id}/attach. To remove a file, write the field's list without its id with /v1/records/mutate. Access to a file follows read access to its record and field. Writes a pending file you uploaded into a record's file field: a pending upload of that field, or a file you gave to Mate in a chat, which is not in any field yet. This is a record update, checked like /v1/records/mutate: mode append adds the file after the existing ones, replace keeps only this file, and expectedVersion guards against a concurrent change. Attaching a file that is already in that field returns it unchanged; a file in another record or field is refused with recordFileUnavailable. Once attached, access follows the record and the field. When the write continues in the background, operationId names the operation to read.

Requires: update access to the record and the file field

POST
/v1/files/{id}/attach

Authorization

apiKeyAuth
x-api-key<token>

API key authentication. Create an API key in your user profile and include it in the x-api-key header.

In: header

Path Parameters

id*string

Id of the file.

Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://customermates.com/api/v1/files/497f6eca-6276-4993-bfeb-53cbbbba6f08/attach" \  -H "Content-Type: application/json" \  -d '{    "typeId": "0b6f3c1e-8a52-4c39-9d7e-2f4a6b8c1d01",    "recordId": "5d2a8c4e-1f3b-4a6d-8e9c-0b1a2c3d4e51",    "fieldId": "c7e1a3b5-2d4f-4a6c-9e8b-0f1a2b3c4d31",    "mode": "append"  }'
{
  "file": {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "typeId": "caab7c42-4ce7-4bd5-bbab-6017cec730b7",
    "fieldId": "84922011-b03d-4966-bc95-c5b49bc2e342",
    "recordId": "0470cfd4-dcf3-4d8c-ac28-58c6deeff25f",
    "name": "string",
    "mimeType": "string",
    "size": 9007199254740991,
    "status": "pending",
    "uploadedAt": "2019-08-24T14:15:22Z",
    "uploadedById": "e4e90afa-33ee-4f3f-ba8f-3fb33b13c87d",
    "extractionStatus": "pending"
  },
  "attached": true,
  "operationId": "3051932a-fdd2-48fa-b330-7e7d41535969"
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
Empty