---
title: "Create a new resource for a given dataset"
method: POST
path: "/datasets/{dataset}/resources/"
tags: ["datasets"]
---

# Create a new resource for a given dataset

`POST /datasets/{dataset}/resources/`

## Request

- Base URL: `https://dados.gov.pt/api/1`
- URL: `https://dados.gov.pt/api/1/datasets/{dataset}/resources/`
- Auth: none declared

## Path parameters

- `dataset` string, required

## Headers

- `X-Fields` string, mask

## Request body

- Resource
  - `checksum` Checksum
    - `type` 'sha1' | 'sha2' | 'sha256' | 'md5' | 'crc': The hashing algorithm used to compute the checksum
    - `value` string, required: The resulting checksum/hash
  - `created_at` string, date-time: The resource creation date
  - `description` string, markdown: The resource markdown description
  - `extras` object: Extra attributes as key-value pairs
  - `filesize` integer: The resource file size in bytes
  - `filetype` 'file' | 'remote', required: Whether the resource is an uploaded file, a remote file or an API
  - `format` string, required: The resource format
  - `harvest` HarvestResourceMetadata
    - `issued_at` string, date-time: The resource harvested release date
    - `modified_at` string, date-time: The resource harvest last modification date
    - `uri` string: The resource harvest uri
  - `id` string: The resource unique ID
  - `internal` ResourceInternals
    - `created_at_internal` string, date-time, required: The resource's internal creation date on the site
    - `last_modified_internal` string, date-time, required: The resource's internal last modification date
  - `last_modified` string, date-time: The resource last modification date
  - `latest` string: The permanent URL redirecting to the latest version of the resource. When the resource data is updated, the URL will change, the latest URL won't.
  - `metrics` object: The resource metrics
  - `mime` string: The resource mime type
  - `preview_url` string: An optional preview URL to be loaded as a standalone page (ie. iframe or new page)
  - `schema` Schema
    - `name` string
    - `url` string
    - `version` string
  - `title` string, required: The resource title
  - `type` 'main' | 'documentation' | 'update' | 'api' | 'code' | 'other', required: Resource type (documentation, API...)
  - `url` string, required: The resource URL

## Response `201`

Success

- Resource
  - `checksum` Checksum
    - `type` 'sha1' | 'sha2' | 'sha256' | 'md5' | 'crc': The hashing algorithm used to compute the checksum
    - `value` string, required: The resulting checksum/hash
  - `created_at` string, date-time: The resource creation date
  - `description` string, markdown: The resource markdown description
  - `extras` object: Extra attributes as key-value pairs
  - `filesize` integer: The resource file size in bytes
  - `filetype` 'file' | 'remote', required: Whether the resource is an uploaded file, a remote file or an API
  - `format` string, required: The resource format
  - `harvest` HarvestResourceMetadata
    - `issued_at` string, date-time: The resource harvested release date
    - `modified_at` string, date-time: The resource harvest last modification date
    - `uri` string: The resource harvest uri
  - `id` string: The resource unique ID
  - `internal` ResourceInternals
    - `created_at_internal` string, date-time, required: The resource's internal creation date on the site
    - `last_modified_internal` string, date-time, required: The resource's internal last modification date
  - `last_modified` string, date-time: The resource last modification date
  - `latest` string: The permanent URL redirecting to the latest version of the resource. When the resource data is updated, the URL will change, the latest URL won't.
  - `metrics` object: The resource metrics
  - `mime` string: The resource mime type
  - `preview_url` string: An optional preview URL to be loaded as a standalone page (ie. iframe or new page)
  - `schema` Schema
    - `name` string
    - `url` string
    - `version` string
  - `title` string, required: The resource title
  - `type` 'main' | 'documentation' | 'update' | 'api' | 'code' | 'other', required: Resource type (documentation, API...)
  - `url` string, required: The resource URL

## Other responses

- `400`: Validation error

## Changes

- **2025-02-18** `8a6c4a5665e6`: 1 breaking, 2 info
  - removed the success response with the status `200`
  - added the non-success response with the status `400`
  - added the success response with the status `201`

[Operation history](https://skmtc.dev/dados/apis/udata-api/changes/datasets/:dataset/resources/post.md)

---

[API](https://skmtc.dev/dados/apis/udata-api.md) - [All operations](https://skmtc.dev/dados/apis/udata-api/llms.txt) - [OpenAPI document](https://skmtc.dev/dados/apis/udata-api/revisions/77edaf8a00ea?raw)
