{"openapi":"3.1.0","info":{"title":"Språkbanken Metadata API","description":"This API provides a quick way to retrieve a list of resources (corpora, lexicons, models, analyses, and utilities)\navailable at Språkbanken. It is used to display resources on the [Språkbanken\nwebsite](https://spraakbanken.gu.se/en/resources).\n\nThe main endpoint `/` lists metadata for all resources (unless the `resource` or `resource-type` parameter is used).\nEach resource is represented as a JSON object that adheres to the JSON schema available from the `/response-schema`\nendpoint.\n\nSome resources have detailed descriptions that are only displayed when using the `resource` parameter. For more\ninformation, please refer to the [GitHub repository](https://github.com/spraakbanken/metadata).\n","contact":{"name":"Språkbanken","url":"https://spraakbanken.gu.se/","email":"sb-info@svenska.gu.se"},"license":{"name":"MIT","url":"https://opensource.org/licenses/MIT"},"version":"4.1.0"},"paths":{"/":{"get":{"tags":["Metadata retrieval"],"summary":"List resources","description":"List metadata for all resources, all resources of a given type or a single resource by ID.\n\nRefer to the `/response-schema` endpoint for the exact JSON schema of a `/resource=<resource_id>` response.","operationId":"list_resources__get","parameters":[{"name":"resource-type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resource type","examples":["corpus"],"enum":["corpus","lexicon","model","analysis","utility","collection"]}},{"name":"resource","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resource ID","examples":["attasidor"]}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AllResouresList"},{"$ref":"#/components/schemas/ResourceList"},{"$ref":"#/components/schemas/Resource"}],"title":"Response List Resources  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/source/{resource_type}/{resource_id}":{"get":{"tags":["Metadata retrieval"],"summary":"Get source metadata YAML as JSON","description":"Return the source metadata YAML file from disk as JSON without applying metadata processing.","operationId":"get_source_metadata_source__resource_type___resource_id__get","parameters":[{"name":"resource_type","in":"path","required":true,"schema":{"type":"string","title":"Resource type","examples":["corpus"]}},{"name":"resource_id","in":"path","required":true,"schema":{"type":"string","title":"Resource ID","examples":["attasidor"]}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Source Metadata Source  Resource Type   Resource Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/list-ids":{"get":{"tags":["Metadata retrieval"],"summary":"List resource IDs","description":"List all resource IDs.","operationId":"list_ids_list_ids_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"string"},"type":"array","title":"Response List Ids List Ids Get"}}}}}}},"/bibtex":{"get":{"tags":["Metadata retrieval"],"summary":"Get BibTeX citation","description":"Return bibtex citation as text.","operationId":"bibtex_bibtex_get","parameters":[{"name":"resource","in":"query","required":true,"schema":{"type":"string","title":"Resource ID","examples":["attasidor"]}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BibtexResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/check-id-availability":{"get":{"tags":["MISC tools"],"summary":"Check resource ID availability","description":"Check if a given resource ID is available.","operationId":"check_id_check_id_availability_get","parameters":[{"name":"id","in":"query","required":true,"schema":{"type":"string","title":"Resource ID","examples":["my-new-resource"]}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdAvailabilityResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/resource-schema":{"get":{"tags":["MISC tools"],"summary":"Resource Schema","description":"Return the JSON schema which is used to validate the metadata YAML files.","operationId":"resource_schema_resource_schema_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Resource Schema Resource Schema Get"}}}}}}},"/validate-resource":{"post":{"tags":["MISC tools"],"summary":"Validate Resource","description":"Validate the provided resource metadata against the resource JSON schema.","operationId":"validate_resource_validate_resource_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Resource","description":"The resource metadata to validate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateResourceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/renew-cache":{"get":{"tags":["Cache management"],"summary":"Renew Cache Get","description":"Trigger cache renewal as a background job (GET).\n\nResources specified in the \"resource-paths\" query parameter will be reprocessed. If no resources are specified, all\nresources are reprocessed.","operationId":"renew_cache_get_renew_cache_get","parameters":[{"name":"resource-paths","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated list of specific resources to reprocess (<resource_type/resource_id>).","examples":["corpus/attasidor,lexicon/saldo"],"title":"Resource-Paths"},"description":"Comma-separated list of specific resources to reprocess (<resource_type/resource_id>)."},{"name":"debug","in":"query","required":false,"schema":{"type":"boolean","description":"If true, log debug info while parsing YAML files.","default":false,"title":"Debug"},"description":"If true, log debug info while parsing YAML files."},{"name":"offline","in":"query","required":false,"schema":{"type":"boolean","description":"If true, skip getting file info for downloadables.","default":false,"title":"Offline"},"description":"If true, skip getting file info for downloadables."},{"name":"purge-license-cache","in":"query","required":false,"schema":{"type":"boolean","description":"If true, re-download the license information before parsing YAML files.","default":false,"title":"Purge-License-Cache"},"description":"If true, re-download the license information before parsing YAML files."}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenewCacheResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Cache management"],"summary":"Renew Cache Post","description":"Trigger cache renewal as a background job (POST).\n\nThe resources to be reprocessed are determined based on the changed files in the webhook payload.","operationId":"renew_cache_post_renew_cache_post","parameters":[{"name":"debug","in":"query","required":false,"schema":{"type":"boolean","description":"If true, log debug info while parsing YAML files.","default":false,"title":"Debug"},"description":"If true, log debug info while parsing YAML files."},{"name":"offline","in":"query","required":false,"schema":{"type":"boolean","description":"If true, skip getting file info for downloadables.","default":false,"title":"Offline"},"description":"If true, skip getting file info for downloadables."}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"description":"Payload from GitHub webhook.","title":"Payload"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenewCacheResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/docs":{"get":{"tags":["Documentation"],"summary":"Docs","description":"Render mkdocs HTML with the developer's guide.","operationId":"docs_docs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/openapi.json":{"get":{"tags":["Documentation"],"summary":"Openapi Json","description":"Serve the OpenAPI specification as JSON data.","operationId":"openapi_json_openapi_json_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/response-schema":{"get":{"tags":["Documentation"],"summary":"Response Schema","description":"Return JSON schema for the resource listings generated by the `/?resource=<resource_id>` endpoint.\n\nThis schema is adapted from the resource metadata schema to reflect the structure of the API response data.","operationId":"response_schema_response_schema_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Response Schema Response Schema Get"}}}}}}},"/redoc":{"get":{"tags":["Documentation"],"summary":"Overridden Redoc","description":"Serve the ReDoc API documentation.","operationId":"overridden_redoc_redoc_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/swagger":{"get":{"tags":["Documentation"],"summary":"Overridden Swagger","description":"Serve Swagger UI API documentation.","operationId":"overridden_swagger_swagger_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}}},"components":{"schemas":{"AllResouresList":{"properties":{"corpus":{"items":{"$ref":"#/components/schemas/Resource"},"type":"array","title":"Corpus","description":"List of corpus resources"},"lexicon":{"items":{"$ref":"#/components/schemas/Resource"},"type":"array","title":"Lexicon","description":"List of lexicon resources"},"model":{"items":{"$ref":"#/components/schemas/Resource"},"type":"array","title":"Model","description":"List of model resources"},"analysis":{"items":{"$ref":"#/components/schemas/Resource"},"type":"array","title":"Analysis","description":"List of analysis resources"},"utility":{"items":{"$ref":"#/components/schemas/Resource"},"type":"array","title":"Utility","description":"List of utility resources"}},"type":"object","required":["corpus","lexicon","model","analysis","utility"],"title":"AllResouresList","description":"List of all metadata resources, grouped by resource type."},"BibtexResponse":{"properties":{"bibtex":{"type":"string","title":"Bibtex","description":"BibTeX citation as text","examples":["@misc{attasidor,\n  doi = {10.23695/f6ds-f045},\n  url = {https://spraakbanken.gu.se/resurser/attasidor},\n            \n  author = {Språkbanken Text},\n  keywords = {Language Technology (Computational Linguistics)},\n            \n  language = {swe},\n  title = {8 Sidor},\n  publisher = {Språkbanken Text},\n  year = {2024}\n}"]}},"type":"object","required":["bibtex"],"title":"BibtexResponse","description":"Response model for BibTeX entries."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"IdAvailabilityResponse":{"properties":{"id":{"type":"string","title":"Id","description":"The resource ID that was checked","examples":["my-new-resource"]},"available":{"type":"boolean","title":"Available","description":"Indicates whether the resource ID is available","examples":[true,false]}},"type":"object","required":["id","available"],"title":"IdAvailabilityResponse","description":"Response model for resource ID availability check."},"RenewCacheResponse":{"properties":{"task_id":{"type":"string","title":"Task Id","description":"ID of the cache renewal task","examples":["c09e5583-dd05-4949-9734-e02b60fad42a"]},"message":{"type":"string","title":"Message","description":"Message indicating the status of the cache renewal request","examples":["Cache renewal triggered in background."]}},"type":"object","required":["task_id","message"],"title":"RenewCacheResponse","description":"Response model for cache renewal requests."},"Resource":{"properties":{"id":{"type":"string","title":"Id","description":"Unique identifier for the resource","examples":["attasidor"]},"type":{"type":"string","title":"Type","description":"Type of the resource","examples":["corpus","lexicon","model","analysis","utility"]},"name":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Name","description":"Name of the resource in multiple languages","examples":[{"en":"8 SIDOR","sv":"8 SIDOR"}]},"short_description":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Short Description","description":"Short description of the resource in multiple languages","examples":[{"en":"News articles from 8 SIDOR.","sv":"Nyhetsartiklar från 8 SIDOR."}]}},"additionalProperties":true,"type":"object","required":["id","type"],"title":"Resource","description":"Metadata resource; keep permissive."},"ResourceList":{"properties":{"resource_type":{"type":"string","title":"Resource Type","description":"Type of the resources","examples":["corpus","lexicon","model","analysis","utility"]},"hits":{"type":"integer","title":"Hits","description":"Number of resources in the list","examples":[42]},"resources":{"items":{"$ref":"#/components/schemas/Resource"},"type":"array","title":"Resources"}},"type":"object","required":["resource_type","hits","resources"],"title":"ResourceList","description":"List of metadata resources."},"ValidateResourceResponse":{"properties":{"valid":{"type":"boolean","title":"Valid","description":"Indicates whether the resource metadata is valid","examples":[true,false]},"message":{"type":"string","title":"Message","description":"Message indicating the result of the validation","examples":["Resource metadata is valid.","An unexpected error occurred during validation."]}},"type":"object","required":["valid","message"],"title":"ValidateResourceResponse","description":"Response model for resource validation against schema."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"tags":[{"name":"Metadata retrieval","description":"Endpoints for retrieving metadata about resources"},{"name":"MISC tools","description":"Endpoints for miscellaneous tools"},{"name":"Cache management","description":"Endpoints for managing the metadata cache"},{"name":"Documentation","description":"Endpoints for API documentation"}],"servers":[{"url":"https://ws.spraakbanken.gu.se/ws/metadata/v4","description":"Production server"},{"url":"https://ws.spraakbanken.gu.se/ws/metadata/dev","description":"Development server"}]}