Skip to content

Create resources ​

Endpoints listed on this page require project tokens with the create or publish ability. See Authentication for more details.

Create a resource ​

POST /v2/resources/{blueprint}

Request body ​

FieldTypeRequiredDescription
attributesobjectYes*Key-value pairs matching the blueprint fields
published_atstringNoISO 8601 date to publish the resource. Omit or set to null for draft. A future date schedules it (see Publishing)

* You can also send the fields at the root of the body, without the attributes wrapper. published_at and variant are then treated as system keys, not fields:

json
{
  "title": "My new post",
  "slug": "my-new-post",
  "published_at": "2026-02-01T12:00:00Z"
}

On a blueprint with variants, the values are stored under the variant query parameter (or the default variant).

Example ​

bash
curl "https://api.diggama.com/v2/resources/posts" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "attributes": {
      "title": "My new post",
      "slug": "my-new-post",
      "content": "<p>Hello world</p>"
    },
    "published_at": "2026-02-01T12:00:00Z"
  }'

Response: 201 Created ​

json
{
  "data": {
    "id": "xR4mN2vBwQy7",
    "type": "resource",
    "published_at": "2026-02-01T12:00:00+00:00",
    "created_at": "2026-02-01T12:00:00+00:00",
    "updated_at": "2026-02-01T12:00:00+00:00",
    "attributes": {
      "title": "My new post",
      "slug": "my-new-post",
      "content": "<p>Hello world</p>"
    },
    "relationships": {
      "blueprint": {
        "data": { "id": "posts", "type": "blueprint" }
      }
    }
  }
}

Validation ​

Field values are validated against the blueprint field types. For example, an email field must contain a valid email address, a number field must be numeric, etc. Fields marked as required in the blueprint must be present. A 422 VALIDATION_ERROR response is returned if validation fails. See Errors.

Reference fields ​

reference fields take the ID of the target resource, and references fields an array of IDs: the same IDs the API returns, so a resource you read can be written back unchanged. Each referenced resource must exist, otherwise the request fails with 422.

json
{
  "attributes": {
    "title": "My new post",
    "author": "gKqv6dx6pBk9",
    "tags": ["xR4mN2vBwQy7", "pL8wZ3kTnHc5"]
  }
}

For bulk creation, see Bulk operations.

Diggama Documentation