All Products
Search
Document Center

AI Coding Assistant Lingma:Add a resource to a session

Last Updated:Jul 03, 2026

Attaches uploaded files or GitHub repositories to an existing session as resources.

Notes

This feature is M3-gated. Upload files through the Files API first to obtain a file_id.

Path parameters

Parameter Type Description
session_id string Session ID with the sess_ prefix

Request headers

Header Required Description
Authorization Yes Bearer $QODER_PAT
Content-Type Yes application/json

Request body

Field Type Required Description
resources array Yes Array of resource objects
resources[].type string Yes One of: "file", "github_repository"
resources[].file_id string Yes File ID obtained from the Files API

Example request

curl -X POST https://api.qoder.com.cn/api/v1/cloud/sessions/sess_019e392c0d1e74e095d21ea4c6b41def/resources \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "resources": [
      {"type": "file", "file_id": "file_abc123def456"}
    ]
  }'

Example response

HTTP 200 OK

Returns the updated session object with the new resources list.

Errors

HTTP Type Trigger
400 invalid_request_error Malformed request (e.g., type is not "file" or "github_repository", or file_id is missing)
401 authentication_error PAT invalid or expired
404 not_found_error Session or file does not exist

Error response examples

Invalid type:

{
  "error": {
    "message": "resources[0]: field 'type' must be one of 'file', 'github_repository'.",
    "type": "invalid_request_error"
  },
  "type": "error"
}

Missing file_id:

{
  "error": {
    "message": "resources[0]: field 'file_id' must be a non-empty string.",
    "type": "invalid_request_error"
  },
  "type": "error"
}

File not found:

{
  "error": {
    "message": "File 'file_fake_test_id' was not found.",
    "type": "not_found_error"
  },
  "type": "error"
}

See Errors for the full error envelope.