跳转至

Agent: Pricing

Read a course's price

GET /api/v1/agent/courses/{course_pk}/price/

Requires pricing: view. price is null when none has been set (the course is free).

Authentication: API key — Authorization: Bearer <key>

Parameter In Required Description
course_pk path yes
COURSE_PK="..."
curl -sS -X GET "https://www-dev.yoshuko.com/api/v1/agent/courses/$COURSE_PK/price/" \
  -H "Authorization: Bearer $YOSHUKO_API_KEY"
import os
import requests

course_pk = "..."
url = f"https://www-dev.yoshuko.com/api/v1/agent/courses/{course_pk}/price/"
response = requests.get(url, headers={"Authorization": f"Bearer {os.environ['YOSHUKO_API_KEY']}"}, timeout=30)
response.raise_for_status()
print(response.json() if response.content else response.status_code)
const course_pk = "...";
const response = await fetch(`https://www-dev.yoshuko.com/api/v1/agent/courses/${course_pk}/price/`, {
  method: "GET",
  headers: { Authorization: `Bearer ${process.env.YOSHUKO_API_KEY}` }
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(response.status === 204 ? response.status : await response.json());
Status Meaning
200 No response body
401 Missing, unknown, revoked or expired key; or the organisation's plan is inactive (subscription_inactive) or unverified (org_unverified).
403 The key's scope for this resource does not allow the action.
429 Rate limited (300 requests/hour per key). Retry after the Retry-After header.

Set a course's price

PUT /api/v1/agent/courses/{course_pk}/price/

Requires pricing: edit. Body: amount (decimal string; "0" makes it free) and optional currency (defaults to the organization's). Refused with 403 free_courses_only on an alpha place, which cannot charge; the body carries a next_action for a person. Same rule as the creator studio.

Authentication: API key — Authorization: Bearer <key>

Parameter In Required Description
course_pk path yes
COURSE_PK="..."
curl -sS -X PUT "https://www-dev.yoshuko.com/api/v1/agent/courses/$COURSE_PK/price/" \
  -H "Authorization: Bearer $YOSHUKO_API_KEY"
import os
import requests

course_pk = "..."
url = f"https://www-dev.yoshuko.com/api/v1/agent/courses/{course_pk}/price/"
response = requests.put(url, headers={"Authorization": f"Bearer {os.environ['YOSHUKO_API_KEY']}"}, timeout=30)
response.raise_for_status()
print(response.json() if response.content else response.status_code)
const course_pk = "...";
const response = await fetch(`https://www-dev.yoshuko.com/api/v1/agent/courses/${course_pk}/price/`, {
  method: "PUT",
  headers: { Authorization: `Bearer ${process.env.YOSHUKO_API_KEY}` }
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(response.status === 204 ? response.status : await response.json());
Status Meaning
200 No response body
201 No response body
400 No response body
401 Missing, unknown, revoked or expired key; or the organisation's plan is inactive (subscription_inactive) or unverified (org_unverified).
403 The key's scope for this resource does not allow the action.
429 Rate limited (300 requests/hour per key). Retry after the Retry-After header.

Read a course's refund policy

GET /api/v1/agent/courses/{id}/refund-policy/

Requires pricing: view. Same body, rules and refusals as the creator-studio endpoint /api/v1/courses/<pk>/refund-policy/.

Authentication: API key — Authorization: Bearer <key>

Parameter In Required Description
id path yes
ID="..."
curl -sS -X GET "https://www-dev.yoshuko.com/api/v1/agent/courses/$ID/refund-policy/" \
  -H "Authorization: Bearer $YOSHUKO_API_KEY"
import os
import requests

id = "..."
url = f"https://www-dev.yoshuko.com/api/v1/agent/courses/{id}/refund-policy/"
response = requests.get(url, headers={"Authorization": f"Bearer {os.environ['YOSHUKO_API_KEY']}"}, timeout=30)
response.raise_for_status()
print(response.json() if response.content else response.status_code)
const id = "...";
const response = await fetch(`https://www-dev.yoshuko.com/api/v1/agent/courses/${id}/refund-policy/`, {
  method: "GET",
  headers: { Authorization: `Bearer ${process.env.YOSHUKO_API_KEY}` }
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(response.status === 204 ? response.status : await response.json());
Status Meaning
200 No response body
201 No response body
204 No response body
400 No response body
401 Missing, unknown, revoked or expired key; or the organisation's plan is inactive (subscription_inactive) or unverified (org_unverified).
403 The key's scope for this resource does not allow the action.
404 No such object in this key's organisation.
429 Rate limited (300 requests/hour per key). Retry after the Retry-After header.

Replace a course's refund policy

PUT /api/v1/agent/courses/{id}/refund-policy/

Requires pricing: edit. Same body, rules and refusals as the creator-studio endpoint /api/v1/courses/<pk>/refund-policy/.

Authentication: API key — Authorization: Bearer <key>

Parameter In Required Description
id path yes
ID="..."
curl -sS -X PUT "https://www-dev.yoshuko.com/api/v1/agent/courses/$ID/refund-policy/" \
  -H "Authorization: Bearer $YOSHUKO_API_KEY"
import os
import requests

id = "..."
url = f"https://www-dev.yoshuko.com/api/v1/agent/courses/{id}/refund-policy/"
response = requests.put(url, headers={"Authorization": f"Bearer {os.environ['YOSHUKO_API_KEY']}"}, timeout=30)
response.raise_for_status()
print(response.json() if response.content else response.status_code)
const id = "...";
const response = await fetch(`https://www-dev.yoshuko.com/api/v1/agent/courses/${id}/refund-policy/`, {
  method: "PUT",
  headers: { Authorization: `Bearer ${process.env.YOSHUKO_API_KEY}` }
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(response.status === 204 ? response.status : await response.json());
Status Meaning
200 No response body
201 No response body
204 No response body
400 No response body
401 Missing, unknown, revoked or expired key; or the organisation's plan is inactive (subscription_inactive) or unverified (org_unverified).
403 The key's scope for this resource does not allow the action.
404 No such object in this key's organisation.
429 Rate limited (300 requests/hour per key). Retry after the Retry-After header.