Skip to main content
PATCH
/
api
/
v1
/
materials
/
{id}
Update a material
const url = 'https://studyfetchapi.com/api/v1/materials/{id}';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
  body: '{"references":[{"title":"<string>","url":"<string>"}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
{
  "_id": "<string>",
  "name": "<string>",
  "organizationId": "<string>",
  "folderId": "<string>",
  "contentType": "text",
  "content": {
    "text": "<string>",
    "url": "<string>",
    "s3Key": "<string>",
    "s3Url": "<string>",
    "filename": "<string>",
    "fileSize": 123,
    "mimeType": "<string>"
  },
  "metadata": {},
  "status": "active",
  "usage": {},
  "references": [
    {
      "title": "Understanding Photosynthesis",
      "url": "https://example.com/article"
    }
  ],
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z"
}

Authorizations

x-api-key
string
header
required

API Key for authentication

Path Parameters

id
string
required

Material ID

Body

application/json
references
object[]

Array of references to update (optional)

Response

Material updated successfully

_id
string
required

Material ID

name
string
required

Material name

organizationId
string
required

Organization ID

folderId
string | null
required

Folder ID

contentType
enum<string>
required

Content type

Available options:
text,
pdf,
video,
audio,
image,
epub
content
object
required

Material content

status
enum<string>
required

Material status

Available options:
active,
processing,
pending_upload,
error,
deleted
createdAt
string<date-time>
required

Creation timestamp

updatedAt
string<date-time>
required

Last update timestamp

metadata
object

Material metadata

usage
object

Usage information

references
object[]

References that this material cites

I